Shutdown Check

Search documentation

Find a page or section

SC301: Service exited with the wrong code

SC301 (service exited with the wrong code) means the process exited with a code other than shutdown.exitCode, or was killed by a signal. How to fix both.

SC301 means the service stopped in time, but its exit did not match shutdown.exitCode. It may have returned a nonzero code or ended directly from a signal.

CodeSC301 FAIL
StageProcess exit
CLI exit code1
What it meansThe process exited, but with a different exit code than shutdown.exitCode, or was killed by a signal.
Messages
  • Service process failed: <error>
  • Service exited with code <code> and signal <signal>; expected code <shutdown.exitCode>
First thing to checkHandle SIGTERM yourself so Node does not exit with the signal, and check what sets process.exitCode during cleanup.

What does the timeline tell me?

  • code=1, signal=none means application code set a failure exit code.
  • code=null, signal=SIGTERM usually means there is no effective signal handler.
  • Another signal name points to a crash or an external kill.

How do I fix it?

Install a SIGTERM handler on the process that actually runs the server. Set process.exitCode only when cleanup fails, and inspect stderr for the original error.

If a nonzero exit is intentional, set shutdown.exitCode to that value. Most services should still exit with 0 after a planned shutdown because process managers treat a nonzero code as a crash.

How do I verify the fix?

The timeline should show the configured code and signal=none. Also check the service logs: a clean code with a hidden cleanup error is not a healthy shutdown.

If signal=SIGTERM remains, confirm that the listener is installed on the actual server process and not only on a parent wrapper.