Skip to main content
Reference

Exit Codes

Understand CLI exit codes for scripting and CI integration.

Exit Codes

CodeMeaning
0Success
1Runtime error
2--fail-on threshold exceeded

Using Exit Codes

In Scripts

vg scan
if [ $? -eq 2 ]; then
  echo "Drift threshold exceeded"
  exit 1
fi

In CI

Exit code 2 is returned when:

  • --fail-on error and error findings exist
  • --fail-on warn and warning findings exist
  • --drift-budget is exceeded
  • --drift-worsening threshold is exceeded

Example

vg scan --fail-on error || echo "Scan failed with code $?"

Related Documentation