sndev.io / docs

Exit Codes

Standardized exit codes returned by the sn CLI.

The sn CLI uses standardized exit codes so CI wrappers and shell scripts can distinguish between failure classes without parsing output text.

CodeMeaningWhen
0SuccessCommand completed without error
1Runtime errorNetwork failure, instance rejected the request, assertion failed
2Usage errorMissing argument, unknown flag, bad manifest path, or unrecognized subcommand
3HTTP errorNon-2xx response from the target instance (`sn rest`), or drift gate blocked execute
4Health gateRegression lock conflict or health preflight threshold exceeded
130SIGINTUser hit Ctrl-C mid-run (POSIX convention)
143SIGTERMProcess was killed externally (POSIX convention)

Pair with $? in shell scripts to branch on failure class:

sn execute manifest.ts
code=$?
if [ $code -eq 0 ]; then
  echo "Deploy succeeded"
elif [ $code -eq 3 ]; then
  echo "Drift detected — check sn drift manifest.ts"
elif [ $code -eq 4 ]; then
  echo "Health gate blocked — check sn regression"
else
  echo "Unexpected failure (exit $code)"
fi

Exit codes 130 and 143 follow the POSIX convention of 128 + signal_number (SIGINT=2, SIGTERM=15). Most CI systems surface these automatically as "cancelled" or "killed" rather than a raw number.