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

Errors

Wherever brnr reports an error as data, it is "error": {"code", "message"} (ADR 8.7):

  • a bridge or socket reply that fails: {"ok": false, "error": {…}} (bridge protocol);
  • an event or note that reports a failure: turn_ended, process_exited, events_missed, records_skipped;
  • the error of --wait’s turn, of last_turn and of session delete;
  • a failed command with --json: its stdout is {"error": {code, message}} (output), unless it printed its JSON before it failed: a stream’s events, or a wait’s turn, which a failed turn’s wait prints too (exit 1), its error in it.

On stderr a failure is brnr: <message> [<code>], in text and with --json alike. A usage error (exit 2), a wait’s timeout (124) and a cut-off (3) have their exit status instead, and no code; doctor exits 1 with its checks. The library’s facade returns a usage error as usage_invalid.

FieldTypeMeaning
errorobjectThe failure, where a command or a reply has one.
error.codestringOne of the codes below.
error.messagestringWhat failed, for people. Not covered.
error.rpc_errorobject, optional, ACP’sWith agent_failed only: the agent’s JSON-RPC error, whole, as it sent it ({code, message, data}).

Where the agent’s answer failed, the code is agent_failed, and rpc_error is the agent’s error, whole. Its numeric code is ACP’s; brnr’s codes are words. A script that needs ACP’s reads rpc_error.code.

{
  "error": {
    "code": "agent_failed",
    "message": "session/new failed: Authentication required",
    "rpc_error": {
      "code": -32000,
      "message": "Authentication required"
    }
  }
}

Covered from 1.0.0: each code below and what it means. A minor release can add a code, for a new failure or for one that was unclassified. Not covered: message, and unclassified, which promises nothing.

A running session

A command on a running session, <session>, finds it first. These are the errors of that, whatever the command:

  • session_not_found: brnr knows no session of that id.
  • session_inactive: it isn’t open in any process; resume it.
  • session_active: it is open where the command needs it not to be.
  • session_closing: it is closing; it is free once its records are written, 2 s at most.
  • session_opening: it is opening, and takes no requests until it has.
  • process_unreachable: the process that holds it doesn’t answer, or can’t be reached from here.

Every command that asks a process can also get command_unknown, from a process of another brnr (ADR 8.8), and unclassified.

Codes

CodeThe failure
acp_version_unsupportedThe agent speaks an ACP version brnr doesn’t.
agent_exitedThe agent exited, and its process with it, before the command was done: a start, a wait, a request.
agent_failedThe agent answered with a JSON-RPC error; rpc_error is that error, as the agent sent it.
agent_not_startedNo agent to start: none given or recorded, or its program can’t be run.
answer_invalidAn answer that doesn’t fit its permission request or elicitation: no such option, a kind missing or doubled, the other side’s option, content that doesn’t fit the form, an action that isn’t one.
capability_missingThe agent doesn’t advertise what was asked: forking, closing, resuming, listing or deleting sessions, steering, images, an MCP server’s transport.
command_invalidA socket request that isn’t one: not JSON, no cmd, a field missing or of the wrong type, fields that don’t go together.
command_unknownA cmd the process doesn’t have, or a field of one it doesn’t take: a newer brnr’s request to an older brnr’s process; or a status answer without a field this brnr reads, an older brnr’s.
config_invalidThe config file can’t be read, isn’t private, or doesn’t load.
event_unknownA note’s name in subscribe’s events: no process sends one. An event brnr doesn’t have, or a note, in a profile’s bridge events. In subscribe, an event the process doesn’t have isn’t an error: it is named in unknown_events.
experimental_disabledAn action on an editor’s session its profile doesn’t enable.
input_invalidWhat the command reads besides its command line won’t do: an empty prompt on stdin, stdin that isn’t the form’s fields, a file or image that can’t be read or sent, a --cwd that isn’t a directory.
message_not_foundNo held message has that id.
process_not_foundNo brnr process has that pid.
process_owned_by_editorAn editor’s process: no session is opened or forked in it.
process_panickedbrnr itself failed, and its process ended: a bug to report.
process_startingThe process hasn’t committed its start.
process_stoppingThe process is stopping, or its agent takes no more input.
process_unreachableThe process doesn’t answer, or can’t be reached from here (another BRNR_DIR).
profile_not_foundThe config has no profile of that name.
remote_brnr_not_found--remote: no brnr on the destination shell’s PATH; set it in ~/.zshenv or ~/.bashrc there (ADR 12.2).
remote_version_mismatch--remote: the destination’s brnr is another version, or has no remote support (ADR 12.1).
request_not_foundNo permission request or elicitation of that handle is waiting.
session_activeThe session is open in a process, where the command needs it not to be: close it first, or take it over.
session_closedThe session closed before the command was done.
session_closingThe session is closing; it is free once its records are written (2 s at most).
session_inactiveThe session isn’t open in any process; it can be resumed.
session_not_foundbrnr knows no session of that id.
session_openingThe session is opening, and takes no requests until it has.
setting_invalidA mode, model, thought level, config option or login method the agent doesn’t offer, or a value it doesn’t take.
start_timed_outThe session didn’t open in the time its start had.
strict_mode_refusedStrict mode refuses what isn’t stable ACP.
transcript_not_keptThe process keeps no transcript to read, or no raw ACP (log).
transcript_unsupportedThe transcript is in a format this brnr doesn’t read.
turn_owned_by_editorThe editor’s session’s turns are the editor’s: a steer, an interrupt, or a prompt while its turn runs.
unclassifiedAnything else. It promises nothing: don’t match it.
usage_invalidThe arguments don’t make a command. Only the library’s facade returns it: the command line exits 2 for it, with its usage and no code.