ERR_SERVER_NOT_RUNNING
node
cluster
ai_generated
true
Error [ERR_SERVER_NOT_RUNNING]: Server is not running.
ID: node/node-cluster-disconnect
85%Fix Rate
88%Confidence
50Evidence
2023-01-01First Seen
Version Compatibility
| Version | Status | Introduced | Deprecated | Notes |
|---|---|---|---|---|
| 20 | active | — | — | — |
Root Cause
A cluster worker disconnected unexpectedly from the master process, usually due to an unhandled exception, memory exhaustion, or explicit disconnect call before the server was ready.
genericWorkarounds
-
90% success Listen for 'disconnect' and 'exit' events on the cluster and fork replacement workers
cluster.on('exit', (worker, code) => { if (!worker.exitedAfterDisconnect) cluster.fork(); }); -
88% success Implement graceful shutdown with server.close() before disconnecting
In the worker: server.close(() => { process.disconnect(); }); — ensures all connections drain before exitingSources: https://nodejs.org/api/cluster.html#workerdisconnect
Dead Ends
Common approaches that don't work:
-
Calling cluster.disconnect() before workers have fully initialized
75% fail
Workers that haven't bound to a port yet will silently fail to clean up, leaving orphaned connections
-
Using process.exit() in workers instead of graceful shutdown
80% fail
Abrupt exit drops in-flight requests and can corrupt shared state or IPC channels
Error Chain
Leads to:
Preceded by:
Frequently confused with: