SC201 means an active request lost its connection after SIGTERM. Users
often see the same failure as a reset connection or a 502 during deployment.
| Code | SC201 FAIL |
|---|---|
| Stage | In-flight responses |
| CLI exit code | 1 |
| What it means | A request that was running when SIGTERM arrived was cut off: the connection was reset or closed before the response ended. |
| Message |
|
| First thing to check | Do not call process.exit(), closeAllConnections() or destroy sockets while requests are still being answered. |
What usually cuts the request off?
- There is no
SIGTERMhandler, so Node.js exits immediately. - The handler calls
process.exit()before requests finish. - Code destroys all sockets, including active ones.
- A wrapper process dies and takes the server with it.
- A second signal forces an early exit.
How do I fix it?
Use server.close() to stop new connections and wait for its callback before
finishing cleanup. Do not destroy active sockets.
process.on("SIGTERM", () => {
server.close((error) => {
if (error) process.exitCode = 1;
});
});If you track idle keep-alive connections, close only the idle connections. Active responses must be allowed to end normally.
How do I verify the fix?
The request should now end with HTTP <status> instead of aborted,
ECONNRESET, or another socket error. The process must exit only after the
request-finished event.
Run the test with repeatSignalAfterMs when operators or process managers may
send a second signal. This catches an early-exit branch that a single signal
does not reach.