Skip to main content

Exit codes

arc uses structured exit codes so scripts can react to specific conditions without parsing stderr.

CodeNameMeaningWhat to do
0SuccessCommand completed successfully
1ErrorGeneral errorRead stderr for details
2Not initializedNo stack found in the current repoRun arc init
3Rebase conflictA branch could not be rebased cleanlyResolve conflict, then arc rebase --continue or arc rebase --abort
4GitHub API failuregh returned an errorCheck gh auth status, verify network, retry
5Invalid argumentsBad flag combination or missing required argumentRead stderr for the specific error
6Setup check failedEnvironment not configuredRun arc setup
7Pre-hook failedA pre-* hook returned non-zeroFix the check, or pass --skip-hooks

Using exit codes in scripts

arc sync
status=$?

case $status in
0) echo "Sync complete" ;;
3) echo "Conflict — resolve and run arc rebase --continue" ;;
4) echo "GitHub API error — check gh auth status" ;;
*) echo "Unexpected error $status" >&2; exit $status ;;
esac
# Abort the pipeline if arc is not initialized
arc status >/dev/null 2>&1 || { echo "Run arc init first"; exit 1; }

Notes

  • Exit code 3 (conflict) is not an error — it is the expected outcome when a rebase hits conflicting changes. Scripts should branch on it, not treat it as a failure.
  • arc rebase --continue and arc rebase --abort both exit 0 on success.
  • --dry-run always exits 0 if the plan was computed successfully, regardless of what the plan contains.