Skip to main content

Module failure

Module failure 

Source
Expand description

Classification of agent (Claude CLI) run failures into a small, stable taxonomy with a human-readable explanation.

classify() is a pure function: it takes the exit code, the terminating signal, the tail of the child’s stderr, and an optional terminal result frame, and returns an AgentFailure. It does no IO and is exhaustively unit-tested against the real Anthropic error phrasings, so the “why” behind a non-zero exit can be surfaced to the user instead of a bare exit 1.

See docs/specs/SPEC_AGENT_FAILURE_DIAGNOSTICS_2026_06_11.md. This is the P1 (capture + classify) slice; live-stream emission and UI banners are P2/P3.

Modules§

rules
The rules classify tries, in order, to name a failure. A rule answers Some failure when the evidence is its cause, None when it is not.

Structs§

AgentFailure
A classified agent failure: the class, a user-facing title + detail, the raw exit evidence, the stderr tail, and whether a retry is worth attempting.

Enums§

FailureClass
Stable failure taxonomy. Wire format is snake_case to match the rest of the agent event surface (frontend/types/srv-types.d.ts).

Constants§

ROUTE_CREDITS_TITLE
The title of a UsageLimit failure whose cause is a model route with no credits left (HTTP 402).

Functions§

classify
Classify an agent run failure.
open_in_other_pane_holder
The block id in held_elsewhere_error’s “already open in another pane (block X)” refusal, when text is that refusal. The wording is ours, built in one place, so this reads it back.