Fix EADDRINUSE and "address already in use" errors
Fix EADDRINUSE, EACCES and Address already in use errors on Schokr by using your allocated port and making sure only one server listens on it.
Updated · 2 min read
EADDRINUSE (Node.js and Bun) or OSError: [Errno 98] Address already in use (Python) means your app tried to listen on a port that something else is already using. On Schokr, the fix is usually to use the right port and to start only one listener on it.
Cause 1: your app listens twice
The most common cause is code that starts two servers on the same port:
- Express: calling
app.listen()and also creatinghttp.createServer(app).listen(). - Socket.IO or ws: creating a separate server on the same port as Express instead of attaching to the existing one.
- Bun with Hono: using
Bun.serve({ fetch: app.fetch })and alsoexport default app. - Python: calling
app.run()inside a file that gunicorn or uvicorn also imports, so the dev server starts during import.
Fix: listen exactly once, and attach WebSockets to the same HTTP server. For Python, protect dev-only startup code:
if __name__ == "__main__":
app.run(host="0.0.0.0", port=5000)
Cause 2: multiple workers binding the port themselves
With gunicorn or uvicorn --workers, the master process owns the port and shares it with workers. If your code also opens the port in each worker (for example starting a second server in a module-level statement), every extra worker fails. Move that code out of module level.
In Node.js cluster mode, use the cluster module properly, or simply run one process.
Cause 3: a wrong port number
Only the ports in your server's Network section are yours. Listening on another port may conflict with something else, or it may "work" but be unreachable. Use the allocated port. See binding to 0.0.0.0 and the right port.
Cause 4: the previous process has not exited
If you restart very quickly after a crash, the old process may still hold the port for a moment. Stop the server, wait a few seconds until it shows as offline, then start it again.
Also handle shutdown signals so your app closes the port cleanly:
process.on('SIGTERM', () => server.close(() => process.exit(0)))
EACCES: permission denied
EACCES when listening means you chose a privileged port (below 1024, such as 80 or 443). Apps on Schokr cannot use those. Use your allocated port, and if you want visitors on port 80 or 443, put a proxy in front. See using your own domain.
Need a second port?
If your app genuinely needs two ports (for example a game API plus a dashboard), add another allocation in the Network section. Extra allocations cost 25 credits each, or are unlimited with Schokr One. Often you can serve both on one port with path-based routing instead.
Find what you started
Log the port on startup so you can see exactly what your code is doing:
server.listen(port, '0.0.0.0', () => console.log('Listening on', server.address()))
If you still see the error twice in a row, search your code for every listen(, serve( and run( call.