Skip to content
GhostbranchdocsGitHub

Exit codes

What each ghostbranch exit code means and what to do about it.

Every command exits with one of these codes. With --json, the result’s exit_code is the same number, and error.code says more (see Error and warning codes). ghostbranch explain <number> prints a row.

Exit code Meaning What to do
0 Success. Read data and next.
1 The command failed for a reason other than usage, the gate, a conflict or approval. Read error.code and run ghostbranch explain <code>; retry when error.retryable is true.
2 The command was called wrongly: a bad flag, missing input, or an unknown name. Fix the input named in error.field and run the command again.
3 The gate failed: CI failed or did not run, or the leak scan found something. Fix the feature (code, tests or leaked content) and gate again. Never try to work around the leak scan.
4 The repos are in a state the command will not change on its own: a rebase conflict, a diverged branch, or a name already taken. Resolve the conflict named in the error, then run the command again.
5 A person has to approve this before it runs: a publish, or a delete or unregister that can’t be undone. Stop. Give the human the command in next; it needs a person at a console. For promote and apply, an agent grant they make with ghostbranch agents allow also works.
6 The repos changed since the plan was made, so the plan was not applied. Make a new plan (the command in next) and apply that one.