Skip to content

Exit codes

The exit statuses abx returns, including one-shot launches that pass through the guest command's status.

Updated

abx returns one of four statuses of its own, and a one-shot launch can also return the status of the guest command. In scripts, branch on the status first and read the error code from the JSON envelope for the cause.

Code Meaning
0 Success.
1 The command failed.
2 Usage error: unknown command, option or argument, including a missing or malformed option value and conflicting flags (error code usage).
125 A one-shot run or shell failed in abx itself, including usage errors. Linux host policy also returns 125 when it refuses an operational command before execution.

One-shot launches

A launch is one-shot when it does not attach a terminal: a guest command after -- for shell, --no-tty before --, or stdin or stdout that is not a terminal. Agent launches with arguments after -- still attach a terminal when one exists.

abx waits for a one-shot command and exits with its status, or with 128 plus the signal number when the command was killed by a signal, for example 143 for SIGTERM. SIGTERM and SIGHUP sent to abx are forwarded to the command, and so are SIGINT and SIGQUIT sent with kill.

A failure that abx itself reports in a one-shot launch exits 125, whatever its error code: a missing box or image, a usage error, an unknown option, needs-terminal and so on. Any other status came from the guest, so 1 or 2 can be the agent’s own. A failure that smolvm reports while running the command comes back as the command’s status.

An interactive launch replaces abx with smolvm once the box is open, so its status is then the guest’s. A failure before that point exits 1 or 2 (or 125 when Linux host policy refuses the command).

abx claude fix-auth --no-create --no-tty -- -p "fix the failing test"
echo $?

In that example 125 means abx failed (for example no-box with --no-create). Any other status is the agent’s. See headless automation.

Multi-box commands

stop --all, rm with several boxes and similar commands keep going after a failure. They print the result document on stdout, list the failures in failed, and exit 1 without an error envelope. See JSON output.

Streams

Results and JSON go to stdout. Diagnostics, progress and errors go to stderr, and errors start with abx: when stderr is not a terminal.

Type to search…

↑↓ navigate↵ selectEsc close