Node "process.exit called with code 1" Fails the Job in CI - Trace the Cause
A non-zero process.exit(1) is a deliberate failure signal. CI treats any non-zero exit as a failed step, so the question is which condition tripped the exit.
What this error means
A node script ends the job with exit code 1, sometimes with little output, because code called process.exit(1) on a validation, missing config, or caught error.
> node scripts/check-env.js
Missing required env var: DATABASE_URL
Error: Process completed with exit code 1.Common causes
A guard script exits on a failed precondition
A check script calls process.exit(1) when a required env var, file, or condition is absent in CI.
A caught error is rethrown as an exit
A try/catch logs the error and calls process.exit(1), hiding the original stack behind the exit code.
How to fix it
Read the message before the exit
- Find the process.exit(1) call and the log line printed just before it.
- Fix the failing precondition (set the env var, provide the file).
Surface the underlying error
- Log the full error before exiting so CI shows the real cause.
- Prefer setting process.exitCode and letting the process end naturally.
catch (err) {
console.error(err);
process.exitCode = 1;
}How to prevent it
- Make exit-on-failure scripts log a clear reason, prefer process.exitCode over an abrupt exit so flushing completes, and document the preconditions CI must satisfy.