Open-Source Wikis

/

Node.js

/

Reference

/

Exit codes

nodejs/node

Exit codes

Source: src/node_exit_code.h. The leading comment in that file is unusually candid about which codes were intended versus what code actually does in practice.

Code Symbol When
0 NoFailure Normal exit.
1 GenericUserError Catch-all for uncaught JS exceptions and generic errors.
3 InternalJSParseError Internal JS parse error (rare; usually pre-compiled builtins fail at snapshot).
4 InternalJSEvaluationFailure Reserved (mostly produces exit 1 in practice).
5 V8FatalError Reserved; SIGTRAP/SIGABRT often produce 133/134 instead.
6 InvalidFatalExceptionMonkeyPatching User reassigned process._fatalException.
7 ExceptionInFatalExceptionHandler The fatal exception handler itself threw.
9 InvalidCommandLineArgument Unknown / malformed flag.
10 BootstrapFailure The bootstrap (Realm::BootstrapRealm) failed.
12 InvalidCommandLineArgument2 Duplicate of 9 historically; retained for compatibility.
13 UnsettledTopLevelAwait Top-level await in a main module never resolved.
14 StartupSnapshotFailure --build-snapshot or snapshot deserialization failed.
128 + N (signal) Unix convention for "killed by signal N".
134 Abort process.abort() or an internal CHECK failure.

Codes 2, 8, 11 are intentionally unassigned. The exit codes that come from V8 itself (V8FatalError, signal-based exits) often surface as the kernel's 128 + signum convention rather than the codes in this table.

The C++ helper node::Exit(ExitCode) (src/node_exit_code.h) is the canonical exit path. JS-side process.exit(code) ultimately calls Exit after running cleanup.

Built by Factory AutoWiki from public repository content. It is a generated preview for codebase exploration, not source-maintained documentation.

Exit codes – Node.js wiki | Factory