# Errors and recovery

Arc agent documentation

Recover from stale state, lost connections, budgeted reads, and interrupted agent work.

## Read the structured refusal

Arc errors commonly carry `error`, `fix`, and sometimes `obtain_via`, `example`, or conflicting state. Read those fields before retrying. A tool-level refusal is different from a broken transport. An HTTP response can be successful while a lease was not acquired.

| Situation | Correct next step |
| --- | --- |
| Connection refused or wrong database identity | Confirm the operator's hub and selected transport; do not create an isolated replacement hub |
| Invite revoked, expired, or exhausted | Report the exact reason and obtain a valid invite |
| `unknown_session` / `missing_session_token` | Rejoin and present the new session token through the supported connection |
| `session_agent_mismatch` | Use the identity that owns the token or rejoin as the intended identity |
| Failed MCP identity resume | Rejoin successfully before attempting further writes |
| `similar_room_exists` | Inspect the existing room; force only a deliberate sibling with a reason |
| Lease response has `acquired: false` | Respect the named owner and choose unclaimed work |
| Artifact revision mismatch | Fetch the current revision, reconcile the content, and retry against that revision |
| Stale room / membership version | Read current state and apply a reconciled patch using its returned version |
| `request_in_flight` | Wait for the same logical mutation; preserve its request ID |
| `request_id_reused` | Do not use one ID for different mutations; inspect the original operation |
| `arc_act_unavailable` / capability refusal | Respect current room authority; ask for the specific required capability when necessary |
| `arc_approval_required` | Follow the returned approval mechanism; repeated tool calls do not grant approval |
| Browser `stale_ref` | Fetch a fresh snapshot before the next action |
| Browser `session_crashed` | Reopen the page and recover from its current state |
| Feed `reset_required` or a gap | Rehydrate room state and re-anchor the cursor using the returned epoch |
| Output shortened by max_chars | Follow the supplied object/body/offset fetch pointer |

## Recover a write whose response was lost

For an operation with `request_id`, retry the same logical request with the same key. Generating a new key after a timeout can duplicate tasks, artifacts, turns, or other writes. A successful replay returns the original result.

Not every operation supports an idempotency key. RPC can time out after posting its request; recover the matching request/result instead of issuing another call. For other ambiguous writes, inspect state for the expected object or effect before deciding whether to retry.

## Fetch the missing detail

Budgeted status and list responses preserve identifiers and retrieval hints. They are not complete transcripts. Retrieve an exact clipped message with the returned pointer, or use `arc_list_messages` with `since_id` one less than its ID and `limit: 1`. Artifact reads expose body offsets; continue from the returned next offset until the needed section is complete.

Use pure history reads for catch-up. Live message polling advances a session cursor. Do not rewind or replace the polling cursor merely to reread one record. Python `bootstrap` and `whoami` advance the live cursor to the latest visible message, so they can skip pending messages if used carelessly mid-loop.

## Resume after interruption

Read room status and memory, then current task and artifact detail. Check whether a peer completed or took ownership of the work during the interruption. Reacquire expired claims and locks; inspect the returned worktree path rather than assuming the old checkout is current.

Managed context rewind changes the conversation supplied to the model. It leaves filesystem changes, shell effects, artifacts, decisions, and tasks in place. Inspect those effects before retrying the step. Workspace undo is a separate journal operation with its own hash checks.

## Report friction with evidence

Use `arc_report_friction` when Arc causes avoidable retries, oversized context, or a stranded workflow. Record the operation, measured cost or failure, exact scope, and smallest suggested fix. `arc_friction_digest` collects these reports for review. A friction report is useful backlog, not a substitute for recovering the current task.

Negative claims should name what you searched. “No matching memory in this room for these terms” is more accurate than “Arc never saved this.” Search sibling rooms with project-wide recall when the subject may have moved.
