Keyboard shortcuts

Press ← or → to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

Exit codes

Covered from 1.0.0: the code of each situation below. A minor release can give a situation that has none a code of its own.

CodeWhen
0Success. --help or -h, the usage on stdout.
1An operation failed: a session, process or profile that isn’t there, an agent’s error, a file that can’t be read. Every error code exits 1.
2A usage error: what the command line alone shows wrong, with nothing done and the usage on stderr.
3A command cut off for falling behind that couldn’t catch up from the transcript.
124A wait’s --timeout passed, as timeout(1) exits.
255SSH connection, authentication or trust failure during remote execution. SSH diagnostics go to stderr; brnr JSON is not guaranteed. A remote command that itself exits 255 is indistinguishable by status alone.

By command

CommandResult
Every command2 for a usage error. 0 for --help or -h.
An ordinary command0 on success; 1 for an operation failure.
event wait, session new --wait, session resume --wait, prompt send --wait124 when the wait’s timeout passes. For a turn: 0 for end_turn, otherwise 1; a dropped message and the session closing or the agent exiting first fail too, 1. event wait --for permission, elicitation and exit exit 0 when the condition is met; --for exit fails, 1, when the connection fails and brnr can’t see the process exit.
event wait --for idleA session idle already, or one that closes while it waits, exits as its last turn ended. Idle is no turn running, nothing held, and no approval or elicitation waiting.
event watch, event notify, event wait, session new --wait, session resume --wait, prompt send --wait3 when the process cut the command off for falling behind and it couldn’t catch up from the transcript: what it missed is an events_missed note (ADR 10.2). event watch prints it as its last event; the others say it on stderr.
brnr acp2 for a usage error; 1 for a config error or a process that fails to start; after the start, as the agent exited, or its signal; 1 if its process dies first (SIGKILL), with lost the connection to its process on stderr.
session new --foreground, session resume --foregroundThe agent’s exit status; a failed start is nonzero.
session delete1 if the agent didn’t delete the session (its error, or no answer), with --purge too, but for an agent that doesn’t have it (resource_not_found): then 0, brnr’s transcript deleted. 1 too if a file couldn’t be deleted or recorded in.
session prune1 if a file couldn’t be deleted, or a session’s lock couldn’t be taken; the others are deleted all the same.
event notifyNon-zero when its connection ends otherwise than with the process, or a signal stops it.
doctor1 if a check failed: read its checks for the cause.

A failed command doesn’t mean that the process or the agent stopped. A wait’s timeout doesn’t cancel its turn. The detailed wait rules are in ADR 8.3.