# API Error Catalog

Every 4xx/5xx response from a Nabu API route carries:

```json
{
  "error": {
    "code": "AUTH_INVALID_CREDENTIALS",
    "message": "Human-readable explanation",
    "category": "actionRequired",
    "retryable": false,
    "retryAfter": null,
    "details": { "field": "projectId" }
  }
}
```

Agent recommended reactions per category:
- `transient` — retry with exponential backoff; respect `retryAfter` when present.
- `permanent` — surface to operator; do not retry.
- `actionRequired` — re-authenticate / acquire permissions / change input.

## AUTH

| Code | Category | Suggested Reaction |
|------|----------|---|
| `AUTH_UNAUTHENTICATED` | actionRequired | Re-authenticate. No credentials presented. |
| `AUTH_INVALID_CREDENTIALS` | actionRequired | Re-authenticate. Credentials present but invalid. |
| `AUTH_SESSION_EXPIRED` | actionRequired | Re-authenticate. Session lifetime exhausted. |
| `AUTH_API_KEY_REVOKED` | actionRequired | Create a new API key. Existing key is dead. |
| `AUTH_INSUFFICIENT_CAPABILITY` | permanent | Surface to operator — key lacks the cap (e.g. `autonomous_write`). |
| `AUTH_INSUFFICIENT_PERMISSION` | permanent | Surface to operator — user lacks the workspace/project role. |
| `AUTH_NOT_WORKSPACE_MEMBER` | permanent | Surface to operator — caller isn't in the target workspace. |
| `AUTH_NOT_PROJECT_MEMBER` | permanent | Surface to operator — caller isn't on the project. |
| `AUTH_SCOPE_INSUFFICIENT` | permanent | Surface to operator — API key scope (`read`/`write`/`admin`) doesn't cover this op. |
| `AUTH_ACCOUNT_SUSPENDED` | actionRequired | 403. An operator suspended this account: every cookie session and API key of it is refused until reinstated — except the account exits a signed-in writer still reaches in the browser (cancel, data export, project backups, deletion request, sign-out;). Do not retry — surface "This account is suspended. Contact support." |
| `AUTH_TERMS_ASSENT_REQUIRED` | actionRequired | 403. The request does not carry agreement to the CURRENT Terms — a sign-up without the form's `termsVersion` (or the OAuth form's `terms`), a page left open across a Terms change, or a re-assent naming a stale version. Reload the page and agree; an agent cannot agree on a person's behalf. |

## VALIDATION

| Code | Category | Suggested Reaction |
|------|----------|---|
| `VALIDATION_INVALID_INPUT` | actionRequired | Inspect `details` and fix the request. |
| `VALIDATION_MISSING_FIELD` | actionRequired | Add the missing field per `details.field`. |
| `VALIDATION_INVALID_FIELD` | actionRequired | Fix the value per `details.field`. |
| `VALIDATION_MALFORMED_BODY` | actionRequired | Send valid JSON. |
| `VALIDATION_TOO_LARGE` | actionRequired | Reduce payload size. |
| `VALIDATION_INVALID_FORMAT` | actionRequired | Fix the format (e.g. ISO timestamp). |
| `VALIDATION_UNSUPPORTED_FORMAT` | actionRequired | Use a supported format (see `details.allowed`). |
| `VALIDATION_SCENE_FIRST_FDX_NOT_SUPPORTED` | actionRequired | Use script-read mode for FDX imports. |
| `VALIDATION_OPENING_TRANSITIONS_NOT_FIRST_SCENE` | permanent | Opening transitions (before a scene heading) may only be stored on the first scene; a create/update/whole save that puts them elsewhere, or a scene-scoped screenplay body carrying them, writes nothing. Re-send a scoped body whole. |

## STATE

| Code | Category | Suggested Reaction |
|------|----------|---|
| `STATE_CONFLICT` | actionRequired | Refetch + retry; another writer raced you. |
| `STATE_PROFILE_OVERRIDE_NOT_PUTTABLE` | permanent | Use the dedicated `/projects/[id]/profile` route. |
| `STATE_LOCKED` | transient | Wait + retry; resource is held by another writer. |
| `STATE_NOT_READY` | transient | Wait + retry; resource not yet in a callable state. |
| `STATE_ALREADY_TERMINAL` | permanent | Operation can't run on a completed/cancelled entity. |
| `STATE_PRECONDITION_FAILED` | actionRequired | Inspect `details` for the failed precondition. |
| `STATE_BARRIER_ACTIVE` | transient | A write barrier is active; retry once it clears. |
| `STATE_ACTIVE_CONVERSIONS_BLOCK_DELETE` | actionRequired | Cancel active conversions or pass `?force=true`. |
| `STATE_TREATMENT_INCOMPLETE` | actionRequired | Complete the present empty sections; `details.emptySections?: string[]` names writer headings. Nothing locked (400). |
| `STATE_PREREQUISITE_NOT_MET` | actionRequired | Complete the listed prerequisite (see `details`). |
| `STATE_INVALID_TRANSITION` | permanent | Operation isn't valid for the current state. |
| `STATE_CONVERSATION_TURN_LIVE` | actionRequired | Nisaba is still answering in this conversation; wait for terminal truth or accepted Stop before sending a new request. |
| `STATE_ALREADY_IN_PROGRESS` | transient | An equivalent operation is in flight; wait + check status. |
| `STATE_ALREADY_COMPLETED` | permanent | Operation has already completed for this entity. |
| `STATE_STALE_CONTENT` | actionRequired | Refresh + retry; content changed since you read it. |
| `STATE_PROJECT_LOCKED` | transient | A long-running operation owns the project lock; wait + retry. |
| `STATE_WIZARD_WRONG_STAGE` | permanent | Wizard isn't at the stage this operation expects. The `message` + `suggestedAction` are DIRECTOR language ("this step already moved on — reopen the wizard to catch up"), never the raw `PipelineStage` enums; the `currentStage`/`requiredStage` enums live in `details` for operators. |
| `STATE_CORRUPT_PROJECT_STATE` | permanent | Surface to operator — project state needs manual repair. |
| `STATE_IMPORT_IN_PROGRESS` | transient | An import is finishing; the write is safely paused. Honor `Retry-After: 30`; the director copy promises saving resumes when the project is ready and never says “Try again” or mentions credits. |
| `STATE_FEATURE_DEFERRED` | permanent | Feature is unavailable in the current build. Today: the Reference Library's member routes ( — `POST /api/references/upload`, `…/[refId]/analyze`, `…/[refId]/promote`, `POST /api/projects/[id]/references`, `PUT /api/projects/[id]/influences`), refused before any admission or charge. |
| `STATE_PROJECT_ARCHIVED` | actionRequired | Project is archived — AI/agent work is blocked. Restore the project before retrying. |
| `PROFILE_OVERRIDE_RACE` | transient | Another writer just updated the profile; retry. |
| `PROFILE_OVERRIDE_NOT_PUTTABLE` | permanent | Use the dedicated `/projects/[id]/profile` route. |
| `STATE_IDEMPOTENCY_KEY_REUSED_WITH_DIFFERENT_BODY` | permanent | Rotate the X-Idempotency-Key (generate a fresh UUID) or send the original body exactly. |
| `STATE_IDEMPOTENT_OPERATION_STATUS_UNKNOWN` | transient | Prior identical request stuck in-progress past the 60s grace window. Contact an admin to resolve via `/api/admin/idempotency/[key]/resolve` before retrying. |
| `STATE_OPERATION_KIND_NOT_CANCELLABLE` | permanent | `POST /api/operations/[id]/cancel` was called for an operation whose kind is not on operation authority — the `isKindOnOperationAuthority` three-way gate, NOT `OPS_AUTHORITY_KINDS` membership (retired ledger-R kinds pass with no env token; a ledger-C token is ignored). Cancel via the kind's existing surface. |

## RESOURCE

| Code | Category | Suggested Reaction |
|------|----------|---|
| `RESOURCE_NOT_FOUND` | permanent | Check the id; entity doesn't exist or was deleted. |
| `RESOURCE_GONE` | permanent | Entity existed but was deleted. |
| `RESOURCE_FORBIDDEN` | permanent | Entity exists but caller isn't authorized to see it. |
| `RESOURCE_DELETED` | permanent | Synonym for GONE; entity was removed. |
| `RESOURCE_ALREADY_EXISTS` | actionRequired | Use the existing entity or pick a different identifier. |
| `RESOURCE_LIMIT_REACHED` | actionRequired | Cap reached (`details.limit`). Delete some or upgrade plan. |

## AI

| Code | Category | Suggested Reaction |
|------|----------|---|
| `AI_PROVIDER_DOWN` | transient | Retry with backoff; the upstream LLM is unavailable. |
| `AI_BUDGET_EXCEEDED` | actionRequired | Top up project credits or wait until budget resets. |
| `AI_GENERATION_FAILED` | transient | Retry once; if persistent, surface to operator. |
| `AI_TOOL_FAILED` | transient | Retry the same call; tool execution had a transient fault. |
| `AI_INVALID_RESPONSE` | transient | Retry; the LLM returned malformed output. |
| `AI_CONTEXT_OVERFLOW` | actionRequired | Compact memory (`/compact` slash command) or start fresh. |
| `AI_PROVIDER_RATE_LIMITED` | transient | Honor `retryAfter`. |
| `AI_LLM_CALL_FAILED` | transient | Retry; LLM call failed at the provider. |
| `AI_LLM_REFUSED` | permanent | LLM refused the request (content policy). Adjust prompt. |
| `AI_LLM_PARSE_ERROR` | transient | LLM output couldn't be parsed; retry once. |
| `AI_TOOL_EXECUTION_FAILED` | transient | Synonym for AI_TOOL_FAILED. Retry once. |
| `AI_TOOL_ROUNDS_EXCEEDED` | permanent | Tool loop hit `maxToolRounds`. Simplify the ask or break into steps. |
| `AI_GENERATION_TIMEOUT` | transient | Retry with a longer timeout. |
| `PROVIDER_OVERRIDE_FAILED` | transient | Provider-fallback override failed; retry. |
| `PLATFORM_LLM_CAP_EXCEEDED` | actionRequired | Platform-wide LLM cost cap hit; operator must reset. |

## BILLING

| Code | Category | Suggested Reaction |
|------|----------|---|
| `BILLING_INSUFFICIENT_CREDITS` | actionRequired | Top up. |
| `BILLING_KIND_PAUSED` | transient | A sticky per-kind absorbed-overage hard pause refuses new admission. Live reservations can reattach; an operator investigates and resets that kind. Soft alerts alone never refuse admission. |
| `BILLING_QUOTA_EXCEEDED` | actionRequired | Top up or wait for quota reset. |
| `BILLING_ALREADY_RESERVED` | permanent | Idempotent retry — operation already in flight. |
| `BILLING_RESERVATION_EXPIRED` | actionRequired | Re-issue the operation; old reservation timed out. |
| `BILLING_STRIPE_WEBHOOK_FAILED` | transient | Operator: inspect `stripe_events`. |
| `BILLING_AGENT_BUDGET_EXCEEDED` | actionRequired | Per-API-key daily $ ceiling hit. `retryAfter` aligns to end-of-day UTC. |
| `BILLING_OPERATION_ALREADY_CAPTURED` | permanent | Operation has already been settled; replay returns the cached result. |
| `BILLING_FEATURE_NOT_INCLUDED` | actionRequired | Follow `details.gate` for a capability that remains plan-gated. Pressed AI work is available on every plan with credit admission; it does not use this refusal. |
| `BILLING_PLAN_LIMIT_REACHED` | actionRequired | Plan cap hit; upgrade or wait for the period to reset. |
| `BILLING_PAYMENT_FAILED` | actionRequired | Payment method declined; update billing info. Emitted by the billing gates when the refusal's real cause is a failed payment; `details.gate` carries the reason and the one way back (`remedy`). |
| `BILLING_SUBSCRIPTION_INACTIVE` | actionRequired | Workspace subscription is inactive; re-activate to proceed. Emitted by the billing gates when a lapsed plan would cure the refusal; `details.gate` carries the reason and `remedy`. |
| `BILLING_IDENTITY_EMAIL_UNRESOLVED` | actionRequired | Workspace owner email is missing; set it before billing. |
| `BILLING_CHECKOUT_EMAIL_UNCONFIRMED` | transient | HTTP 503 from `POST /api/billing/checkout`: the email on the Stripe customer could not be confirmed, so no checkout session was opened and nothing was charged. Retry the same request — the SAME `X-Idempotency-Key` is fine; this refusal is never recorded as the key's answer. |
| `BILLING_PURCHASES_CLOSED` | permanent | Purchases (checkout, the Stripe portal, extra usage) are not open yet — they open at the live flip. Nothing was created; do not retry. |

## RATE_LIMIT

| Code | Category | Suggested Reaction |
|------|----------|---|
| `RATE_LIMIT_QUOTA_EXCEEDED` | transient | Honor `retryAfter`. |
| `RATE_LIMIT_TOO_MANY_REQUESTS` | transient | Honor `retryAfter`. |
| `RATE_LIMIT_BUDGET_EXCEEDED` | actionRequired | Workspace's `dailyAIBudget` cap hit. Top up or wait. |
| `RATE_LIMIT_CONCURRENT_LIMIT` | transient | Too many concurrent operations. Retry once existing ones complete. |

## SYSTEM

| Code | Category | Suggested Reaction |
|------|----------|---|
| `SYSTEM_INTERNAL` | transient | Retry once; surface to operator if persistent. |
| `SYSTEM_NOT_IMPLEMENTED` | permanent | This endpoint isn't built yet. |
| `SYSTEM_DEPENDENCY_DOWN` | transient | Retry with backoff. |
| `SYSTEM_TIMEOUT` | transient | Retry with longer timeout. |
| `SYSTEM_MAINTENANCE` | transient | Site is in maintenance mode; honor `retryAfter`. |
| `SYSTEM_INTERNAL_ERROR` | transient | Generic internal error; retry once + surface to operator if persistent. |
| `SYSTEM_DATABASE_ERROR` | transient | DB query failed; retry once. |
| `SYSTEM_FILESYSTEM_ERROR` | transient | FS operation failed (often write lock contention); retry. |
| `SYSTEM_SERVICE_UNAVAILABLE` | transient | Synonym for DEPENDENCY_DOWN. Retry with backoff. |
| `SYSTEM_OVERLOADED` | transient | Server overloaded; back off + retry. |
| `SYSTEM_CLIENT_VERSION_UNSUPPORTED` | actionRequired | HTTP 400: use a supported dated client contract; preserve local work. |

## `details.reason` discriminants

Some error bodies carry a machine-parseable `details.reason` — a stable, agent-facing
discriminant that says WHICH leg of a route failed, distinct from the human `message`
(which is director copy) and from the operator-only `details.internal` (stripped by
`ApiError.toBody`, never serialized). Per the P2 RULING, a `details.reason`
VALUE is a DOMAIN OUTCOME, never an implementation mechanism, and it may never contain the
banned mechanism vocabulary the `no-mechanism-speak-in-status-copy` lint defines.

| `details.reason` | Route | Meaning (domain outcome) |
|---|---|---|
| `intake-record-failed` | `POST /api/intake/upload` | The import could not be started — a durable record write refused. Retry the upload. |
| `feature-to-short-owed` | `POST /api/intake/[intakeId]/confirm` | The feature import was claimed, but its derived short is still owed. Recoverable `503 SYSTEM_SERVICE_UNAVAILABLE`, `retryable: true`; the same confirm retries the existing intake obligation and returns the same short when its required creation/seed/state writes finish. The import claim and charge stay intact; this is not `intake-import-paused` and does not admit another import. |
| `intake-import-paused` | `POST /api/intake/[intakeId]/classify`, `POST /api/intake/[intakeId]/confirm` | The import could not be handed off to the work that reads the script, so the run was PARKED, not failed — and the refusing request left the row EXACTLY as the writer's last completed action left it: it either claimed nothing, or its claim was REVERTED (a classify claim back to `staged`/`parsed`, a confirm claim back to `classified`). The writer's next action mints a fresh generation and the import continues. The revert is PROVEN, not assumed: the routes derive this token from the coordinator's own result through `intakeParkReasonForCoordination` — only a local mark that actually parked (`localMark: 'parked'`), or a generation that was no longer the one standing on the row (`stale_generation`), earns it; anything else answers `intake-import-recovering` below. Served as a recoverable `503` with `Retry-After: 1` and `retryable: false` — the ONE dispatch-park policy shared with the wizard's `dispatch-parked` class. A NEW request (the writer's next action) is always accepted. **`retryable: false` is what a same-key idempotent REPLAY would be served once these routes are wrapped, so today no replay caching happens on this family.** |
| `growth-result-unknown` | `POST /api/intake/[intakeId]/confirm` | — a "grow into a feature" confirm on an intake whose kept choice (a row whose generation began) cannot be read: whether it made a feature cannot be proven, so none is guessed and none is made beside it. Answered `409` `STATE_PREREQUISITE_NOT_MET` ("We couldn’t confirm whether that went through.") before anything is admitted, reserved or claimed. A safe refusal only: no dedicated recovery choice; her other choices and Start over stay as they are. |
| `routed-import-stale` | `POST /api/intake/[intakeId]/confirm` | — an import ROUTED onto the writer's own wizard project (an `existing-project` attempt opened by her press) no longer matches what the press routed: her wizard moved past its bones, a newer press took another road (the door item's route names another attempt), or the confirm's type is not the door she took (a screenplay tier for the treatment door, an outline or an idea for either) — and, for a routed TREATMENT, a confirm for a press that already began a read without `resume: true`, or one whose read of the row was overtaken by a generation claimed (and parked) since; that second leg is answered after admission, with the reservation released. Answered `409` `STATE_PREREQUISITE_NOT_MET` with "This import is out of date." — before anything is admitted, reserved or claimed (the generation-fence leg releases its reservation), nothing to undo. An agent re-reads the attempt: a stopped read is resumed with `resume: true`; otherwise it presses again and the press answers the attempt that is current. |
| `another-import-running` | `PATCH /api/projects/[id]/wizard` | — Let's Go routed her material to a DOOR (her script's import, her treatment's read) but the workspace already has an import running — or the door her earlier press opened is confirmed, running or holds a billed analysis, so this press cannot let it go (a press that leaves a door lets it go only while it is unbilled, by one fenced transition). Answered `409` `STATE_PREREQUISITE_NOT_MET` with "Another import is running." BEFORE anything of hers is committed (an unbilled earlier attempt may have been let go). With `X-Idempotency-Key`, the refusal is recorded and replays for the key's 24-hour TTL — press again with a NEW key once the other import ends. |
| `import-file-missing` | `PATCH /api/projects/[id]/wizard` | — Let's Go routed her material to a door, but the door item's original is no longer kept on the project (or the item is gone), so there is nothing to import. Answered `409` `STATE_PREREQUISITE_NOT_MET` with "The file to import is no longer on the project." before anything of hers is committed. |
| `intake-import-recovering` | `POST /api/intake/[intakeId]/classify`, `POST /api/intake/[intakeId]/confirm` | The import is PAUSED and the SERVER owns the next step. Same director sentence, same recoverable `503`, same park policy as `intake-import-paused` — the difference is durable state, and it is the difference an agent must not guess: a claim this request made is still STANDING, or a prior step's settlement has not landed, so the writer's re-entry cannot mint a fresh generation yet. Four live producers: a classify refusal whose terminal coordination did not park the row (a `deferred` coordination retains the generation DELIBERATELY — `intake_classify` is lease-less, so the intake row is the only durable pointer to the still-open operation and clearing it would strand the money); the classify idempotent re-attach when the claimed job is AUTHORITATIVELY absent from the queue (it refuses to hand back a job id nothing dispatched — a read outage is not proof of absence and still re-attaches); the confirm capture barrier (the predecessor generation's settlement has not landed); and the confirm sweeper-replay branches, whose claim is left standing ON PURPOSE so `recovery-sweeper.ts` can replay `createJob` from the persisted snapshot. The recovery sweeper (or the money reconciler) resolves it, typically within a tick; nothing is lost and nothing is asked of the writer. |
| `intake-daily-limit` | `POST /api/intake/[intakeId]/classify` | The workspace has already admitted its full number of `intake_classify` operations for the UTC day, so the queue admission gate refused BEFORE writing anything durable. Absence is therefore PROVEN — no operation row, no reservation, no hold — which is why this is the one admission refusal the route CLEARS the claim for: the intake goes back to its pre-classify status and the next UTC day admits again. Same recoverable `503`, same one dispatch-park policy, and deliberately the SAME director sentence as `intake-import-paused`: naming the ceiling in the body would tell whoever is probing it exactly what the limit is and when it resets, which is the anti-enumeration reasoning the auth surfaces already apply. The ceiling itself is `INTAKE_CLASSIFY_DAILY_CAP` (default 20); an agent should treat this as "not today" rather than retrying on the `Retry-After` hint, which carries the shared park value. |
| `intake-source-unavailable` | `POST /api/intake/upload`, `POST /api/intake/[intakeId]/confirm`, `GET /api/intake/[intakeId]/quote` | The uploaded source file could not be read. On upload it is terminal; on confirm/quote nothing durable has been touched, so it PARKS (recoverable `503`) and reopening the import re-enters. |
| `intake-source-unreadable` | `POST /api/intake/[intakeId]/confirm`, `GET /api/intake/[intakeId]/quote` | The file is not a shape Nabu can read as a script. A PREREQUISITE (`400`), not a fault: no replay changes it, and the recovery is the writer's own next upload — the one director sentence on this surface that legitimately asks something of them. |
| `intake-no-scene-headings` | `POST /api/intake/[intakeId]/confirm` | The upload was confirmed on the SCREENPLAY tier but Nabu recovered no scene headings from it, so no scenes would be laid down. A PREREQUISITE (`400`), not a fault and not a park: the refusal runs in the read-only pre-CAS phase, so nothing was claimed, materialized or admitted, and the recovery is the writer's — re-confirm the same upload as `treatment` / `outline`, or upload a different export of the script. Derived from the pre-fallback heading count, never the billable `sceneCount`, whose single-scene fallback reads 1 for exactly this input. Before it existed the confirm proceeded, laid down zero scenes, and the import orchestrator terminated at `scene-zones` with an OPERATOR page the writer saw verbatim. |
| `intake-import-failed` | `POST /api/intake/[intakeId]/confirm` | The project's own MATERIALIZATION is in a state no replay repairs — a partial materialize, a vanished project, a materialize throw, or a confirmed-format write that failed after the row was marked. Terminal `500` with the UNRECOVERABLE copy and the bug report beside it. **Not** emitted for a dispatch refusal any more: a dead dispatch PARKS as `intake-import-paused`. |
| `terminal` | `POST /api/intake/[intakeId]/abandon` | The intake is already in a terminal state — there is nothing to abandon. |
| `dispatch_grace` | `POST /api/intake/[intakeId]/abandon` | The intake's backfill has not dispatched yet — abandoning now could no-op while the dispatch still lands. Wait, then retry. |
| `basis_changed` | `POST /api/projects/[id]/analysis/reread` | The draft moved since the price was quoted (a scene was edited or re-read, or the Notes model changed) — the recomputed basis differs. `GET ?quote=1` again and send its `basis`. Nothing was admitted. |
| `too_long` | `POST /api/projects/[id]/analysis/reread` (and `GET ?quote=1`) | The draft does not fit the context window of a model that may run a whole-draft notes pass. Nothing was started and nothing was truncated; pressing again will not change the answer. Terminal — do not re-quote and retry. |
| `WIZARD_STAGE_USER_STOPPED` | `POST /api/projects/[id]/wizard/extract`, `/wizard/pitch-generate`, `/wizard/spine-extract`, `/wizard/treatment-extract`, guided `/wizard/path-select`, `/wizard/completion-mode`, `/wizard/retry-stage` | Automatic recovery found the latest stage carrier cancelled by the writer. `409` `STATE_PREREQUISITE_NOT_MET`, nonretryable, with `details.jobId` naming the stopped carrier. No new job or admission is created. Follow that terminal job; only a deliberate new request through the stage’s own door (Continue or the pitch action) may start work again. |
| `pitch-request-decided` | `POST /api/projects/[id]/wizard/retry-stage` | r2 — a same-request pitch replay (a manual press or a stale tab) of a request the in-stage loop's fuse already DECIDED (same request contract version) whose admitted holds are spent. Answered `409` `STATE_PREREQUISITE_NOT_MET` with the decided-request sentence BEFORE admission: nothing is held, no job is minted, no model runs, nothing is charged, and the resume budget is not spent. Duplicate deliveries get the same answer. A decided request whose hold is NOT spent keeps the changed-lever door (admitted; the worker's fuse settles an identical walk). The writer re-asks (`pitchReask`). |
| `auto-advance-not-dispatched` | `POST /api/projects/[id]/wizard/retry-stage`; also `POST …/wizard/spine-extract` and `…/wizard/treatment-extract` when the post lands on a live park | The stage resumed, but the follow-on auto-advance could not be dispatched because the persisted actor or the queue's admission liveness could not be read. The stage is PARKED with a bounded retry clock, not failed; `details.action` names the auto-advance action that was withheld. Recoverable `503`. (Documented 2026-09-08, when the census learned to read `machineDetails`.) |
| `completion-mode-recovery-refused` | `POST /api/projects/[id]/wizard/completion-mode` | The pick COMMITTED but its confirming read did not, so the route cannot state the outcome. Not retryable as-is: re-read the wizard state. `details.disposition` carries the operator disposition. Recoverable `503`. |
| `completion-mode-dispatch-parked` | `POST /api/projects/[id]/wizard/completion-mode` | The pick committed and its queue handoff PARKED before a job was confirmed; reopening the wizard resumes the durable handoff. `details.retryStage` + `details.mode` name where and what. Recoverable `503`. |
| `end-state-sync` | `POST /api/projects/[id]/wizard/path-select` (manual path), `POST /api/projects/[id]/wizard/complete` | The wizard reached its last step and the check that every document agrees with the others did not pass, so the wizard was NOT marked complete. Nothing was lost or changed; the same request runs the check again. Recoverable `503`. |
| `completion-mode-already-chosen` | `POST /api/projects/[id]/wizard/completion-mode` | Another window won the completion-mode choice first — this request is the CAS loser, so nothing was changed. Returned under `STATE.INVALID_TRANSITION` with `details.currentStage` (the winner's stage) and, when the winner recorded one, `details.selectedCompletionMode`. Not retryable as-is: re-read the wizard state and follow the mode that won. |
| `completion-mode-request-state-decided` | `POST /api/projects/[id]/wizard/completion-mode` | This exact build was already decided against these exact inputs: the scene-generation stage is PARKED, and the in-stage retry loop's request-state fuse has recorded the request it stopped on. An UNFORCED re-pick of the STANDING mode would re-ask that identical question, so nothing was written and no job was minted. Returned under `STATE.INVALID_TRANSITION` with `details.mode` + `details.retryStage`; the `message` is the park's own director sentence. Retryable only with a CHANGED lever — a different `mode`, or `force: true` — which the server still dispatches (the Forge renders exactly that re-ask on a decided park). The refusal is applied twice — on the pre-lock snapshot and again inside the locked transition — so a park that lands mid-request is not ignored. |
| `completion-mode-park-not-retryable` | `POST /api/projects/[id]/wizard/completion-mode` | The matching `SCENE_GENERATION` park carries the PERMANENT park-global refusal (`canRetry: false` — `/wizard/retry-stage` stamped it when the operation's durable resume budget was spent). An unforced re-pick of the STANDING mode would buy fresh paid provider work against a verdict that will not change, so nothing was written and no job was minted. Returned under `STATE.INVALID_TRANSITION` with `details.mode` + `details.retryStage`; the `message` is the park's own director sentence. Retryable only with `force: true` or a different `mode`. |
| `outage-wait` | `POST /api/projects/[id]/wizard/retry-stage` |: an automatic resume of an OUTAGE park (its provider chain was dark) while the shared breaker still routes away from every dark provider. Nothing was dispatched, nothing metered, the park untouched. Recoverable `503` (`admission-read`) with `Retry-After: 60`; the wizard's resume owner asks again on its schedule until the park's 30-minute wait ends. |
| `nothing-to-recover` | `POST /api/projects/[id]/wizard/spine-extract`, `/treatment-extract`, `/completion-mode`, `/path-select`, `/extract`, `/pitch-generate` (recover mode) |: an automatic (recover) request for a stage whose run is on file but which has no carrier job at all and whose run is not in flight — there is nothing to attach, and an automatic request never buys over a run on file, so nothing was created or charged. (r1: a stage with NO attempt on file — no stage run — is no longer refused: the door's own start runs once under the project lock and answers with its own `202 { jobId }`.) `409 STATE_PREREQUISITE_NOT_MET`. |
| `recovery-in-progress` | `POST /api/projects/[id]/wizard/spine-extract`, `/treatment-extract`, `/completion-mode`, `/path-select`, `/extract`, `/pitch-generate` (recover mode) |: a recover request for a stage whose retryable park owns its recovery. Nothing was resumed, created or charged here; the park's own owner resumes it through `/wizard/retry-stage`. Recoverable `503` (`recovery-wait`). |
| `reask-resting` | `POST /api/projects/[id]/wizard/retry-stage` | r4 R6: the writer's Try again (`reask: true`) on a stage that has already reopened `WIZARD_REASK_MAX_PER_WINDOW` (6) generations in the rolling hour. Nothing written, dispatched or metered. Recoverable `503` (`admission-read`) with `Retry-After` = seconds until the oldest reopen leaves the hour; the wizard shows "Try again in a few minutes." in place of the button (it reads `wizardResumeBudget.reopenedAt` from GET /wizard). |
| `completion-mode-treatment-reading` | `POST /api/projects/[id]/wizard/completion-mode` | A FIRST build-mode pick arrived while the queue could not say whether the build gate's treatment reading (the `treatment-extract` job the spine worker starts before the pick,) is live (`details.readingLiveness: 'unavailable'`), or a pick from SPINE_EXTRACT before the spine is built — its job still runs, or it failed (`details.readingLiveness: 'spine-extract'`,; continue the spine through `/wizard/retry-stage` or `/wizard/spine-extract`, repeating the pick builds nothing). Nothing was written and nothing admitted. Recoverable `503` (`admission-liveness`) with `Retry-After: 5`. **A LIVE reading is not refused:** the pick is accepted with `202 { deferred: true, intentId }` and the reading's terminal starts the build; `GET /wizard` serves `pendingCompletionPick` until then. A reading that STOPPED (dead job / spent park) never holds the pick. |
| `completion-mode-admission-read` | `POST /api/projects/[id]/wizard/completion-mode` | The armed authoritative billing read kept failing while admitting the pick. Since one failed read is waited out inside the request (four tries over ~1.75 s); this answers only an outage that outlasts that wait. Pre-charge and pre-transition: nothing was written or admitted. Recoverable `503` (`admission-pending`, `retryable: true`, `Retry-After: 5`): the SAME `X-Idempotency-Key` re-runs. |
| `completion-mode-park-tip-unavailable` | `POST /api/projects/[id]/wizard/completion-mode` | The supersede-tip authority could not be read, so dispatch did not run. Recoverable `503` (`park-tip`, `retryable: true`, `Retry-After: 1`). |
| `completion-mode-transition-recoverable` | `POST /api/projects/[id]/wizard/completion-mode` | The locked mode+stage transition hit a recoverable fault (a project-lock timeout, a transient save). `details.lockClass` / `details.landing` / `details.transitionFault` carry the class; `retryable` is the class's own replay-safety verdict. Recoverable `503`. |
| `completion-mode-not-pickable` | `POST /api/projects/[id]/wizard/completion-mode` | The wizard is not at a stage where a first pick means anything (`details.currentStage`). `STATE_PREREQUISITE_NOT_MET`; re-read the wizard state. (: the reason is new; the status and message are unchanged.) |
| `wizard-stage-changed` | `POST /api/projects/[id]/ai/chat` | The message was composed in a wizard rail that has since been left behind: its `expectedStage` disagrees with the stage the wizard is persisted on. It exists because the `carry` context policy lets the three wizard rails share ONE conversation, which removes an accidental guard — with a thread per stage a stale rail DISAGREED about the conversation id and was refused, and with a shared thread it AGREES, while prompt and tool selection key on the persisted stage. Nothing was written: the check runs before the binding save and before the message append, so the refusal is PROVEN no-effect and a same-key replay may safely re-run. Recoverable `503` (`conversation-resync`), with `details.expectedStage` and `details.currentStage`. The recovery is the rail's own: re-read wizard state (it is already a `wizard.state.changed` consumer) and send the same words again. |
| `upload-format-mismatch` | `POST /api/intake/upload`, `POST /api/import`, `POST /api/references/upload` | The uploaded file is not the KIND of document its extension claims — the first bytes disagree with the declared format (a ZIP named `.pdf`, a PDF named `.docx`, a binary named `.fountain`). Every ingress format decision was made from the FILENAME alone until 2026-09-15, which is how a zip bomb reached `mammoth` and arbitrary bytes reached pdf.js. Served as `VALIDATION.UNSUPPORTED_FORMAT` (`415`), classified **permanent**: re-sending the same bytes cannot change the verdict, so an agent must re-export rather than retry. Nothing is written — the assert runs before the project mint, the staged write and the workspace claim, so the workspace is left free for the next upload. |
| `image-refused` | `POST /api/bugs` | One screenshot in a multipart support message did not pass the image gate: its BYTES are not PNG/JPEG/WebP (type is read from magic bytes only — SVG, HTML and GIF are refused whatever the declared type or filename says), it declares pathological dimensions, or it cannot be decoded. `details.image` = `{ position, refusal }` with `refusal` ∈ `unsupported-type` / `dimensions` / `undecodable` / `too-large`, and `error.message` names the file in calm words. Served as `VALIDATION.INVALID_INPUT` (`400`), **permanent** for these bytes: remove or replace that image and send again. Nothing is written — no report row, no image. Added 2026-09-28 (Help & feedback modal). |
| `intake-busy` | `POST /api/bugs` | The support intake's fleet limiter could not be reached, so the message was refused (fail closed) — our outage, never the writer's doing; the message says to try again in a moment and never claims they sent too many. Served as `RATE_LIMIT.TOO_MANY_REQUESTS` (`429`) with `Retry-After` 30 s; **transient** — resend after `retryAfter` under a NEW `X-Idempotency-Key`. Nothing is written. Added 2026-09-28. |
| `reports-paced` | `POST /api/bugs` | The writer (or their IP) has sent as many support messages as the intake takes in the window — the SHARED fleet limiter's `support_report_user_hour` (5), `support_report_user_day` (20) and `support_report_ip_hour` (10) buckets, consumed all-or-nothing; crash reports share the budget — and, for a multipart body, the pre-read `support_upload_user_hour` (15) / `support_upload_ip_hour` (30) "bodies read" buckets, spent BEFORE a byte is staged. (An unreachable limiter answers `intake-busy`, not this.) Served as `RATE_LIMIT.TOO_MANY_REQUESTS` (`429`) with `Retry-After` / `error.retryAfter` in seconds and a message that says how long to wait; **transient** — send the same message after `retryAfter` **under a NEW `X-Idempotency-Key`**: the 429 is recorded under the key it answered, so a same-key resend replays the refusal for the key's lifetime (the Help & feedback modal drops its key on every HTTP refusal for exactly this reason). Nothing is written. Replaced the old per-user row count 2026-09-28 (Help & feedback modal). |
| `too-many-images` | `POST /api/bugs` | A multipart support message carried a FOURTH `image` part; the limit is three. The fourth part is refused as soon as it is announced — its bytes are never read. Served as `VALIDATION.INVALID_INPUT` (`400`), **permanent** for this body: send at most three images. Nothing is written. Added 2026-09-28 (Help & feedback modal). |
| `image-refused` (profile picture) | `PUT /api/me/avatar` | The picture did not pass the shared raster gate with the avatar slot's limits: not PNG/JPEG/WebP by its BYTES (SVG, HTML, GIF refused), over the slot's byte cap (5 MB), a header declaring more than 8192 px on an axis or more than 25 megapixels — 4096² for a PNG or WebP (the decompression bomb — refused before any decode) — or undecodable. `details.refusal` ∈ `unsupported-type` / `too-large` / `dimensions` / `undecodable`; `error.message` is the tool-voice sentence. `VALIDATION.INVALID_INPUT` (`400`), **permanent** for these bytes. Nothing is stored and no upload budget is spent. Added 2026-10-13. |
| `paced` | `PUT /api/me/avatar` | The person has changed their picture 5 times this hour (`owner_image_upload_user_hour`, key `avatar:<userId>`), or has sent 20 bodies this hour / their IP 40 (`owner_image_read_user_hour` / `owner_image_read_ip_hour`, spent before a byte is staged). `RATE_LIMIT.TOO_MANY_REQUESTS` (`429`) with `Retry-After`; **transient** — try again after it under a NEW `X-Idempotency-Key` (the refusal is recorded under the key it answered). Nothing is stored. Added 2026-10-13. |
| `too-many-files` | `PUT /api/me/avatar` | The multipart body carried a SECOND `image` part; a picture is one file. Refused as soon as it is announced, unread. `VALIDATION.INVALID_INPUT` (`400`), **permanent** for this body. Added 2026-10-13. |
| `service-budget` / `storage-unavailable` / `limiter-unavailable` / `retired-before-adoption` | `PUT /api/me/avatar` | OUR side, never the person's: the service day's picture budget is spent; the scoped object store cannot take a write (R2 breaker open, or the `BLOB_STORAGE_BACKEND`-unset kill switch); the fleet limiter cannot be reached (fail-closed); or the stored picture was swept before it could be adopted. `SYSTEM.SERVICE_UNAVAILABLE` (`503`) with `Retry-After` and "Pictures can’t be changed right now. Try again later."; **transient** — retry later under a NEW key. Nothing is adopted. Added 2026-10-13. |
| `upload-paced` | `POST /api/intake/upload`, `POST /api/import`, `POST /api/sample-project` (: the sample restore lays a file down as an import does), `POST /api/references/upload`, `POST /api/projects/[id]/material/presign` (the shared document budget), `POST /api/projects/[id]/material/[itemId]/commit` (its own per-item + per-account commit buckets, A0b — checked before any storage call and before the idempotency key is recorded) | The caller is offering document uploads faster than Nabu takes them in — the per-user sliding window refused this one. ONE budget is shared by the three routes on purpose: they cost the same (a bounded body read, two staged copies on the projects volume, a project mint, a main-thread parse), so per-route budgets would be three doors into the same room. Served as `RATE_LIMIT.TOO_MANY_REQUESTS` (`429`) with `Retry-After` and `error.retryAfter` in seconds, classified **transient**: the SAME bytes will be accepted once the window slides, so an agent should back off for `retryAfter` rather than re-shape the request. Nothing is written — the check is the FIRST gate on each route, before the body is read, before the workspace is claimed and before any project is minted. Added 2026-09-15; before it a grep for a rate limit on `/api/intake/*` or `/api/import` returned zero hits. |
| `sample-project-archive` | `PUT /api/projects/[id]` with `archived: true` | The project is the account's sample project, which is never archived: an archived sample could be unarchived past the Free project limit, and Delete plus a fresh press of the sample entry already starts it over. Served as `VALIDATION_INVALID_INPUT` (`400`), classified **deterministic**: the same request is refused every time. Nothing is written: the check runs before the archive transition is planned. |
| `sample-already-loaded` | `POST /api/sample-project` with the Write from Scratch dialog's fields | The account's sample project already came back whole: Write from Scratch loads it once per account, decided at the door from the claim's state; nothing is bound. Served as `STATE_PREREQUISITE_NOT_MET` (`409`), classified **deterministic**: the caller makes the ordinary blank project instead (`POST /api/projects`). |
| `material-upload-invalid` | `POST /api/projects/[id]/material/presign`, `POST /api/projects/[id]/material/[itemId]/commit` | The attachment request or its manifest is malformed, tampered with, or names another project / item / workspace. `VALIDATION.INVALID_INPUT` (`400`), permanent. Nothing is written. A0b. |
| `material-upload-too-large` | the two attachment routes | Over the per-item cap (25 MB). `VALIDATION.TOO_LARGE` (`413`), permanent — "This file is too large." Nothing is presigned or spent. |
| `material-upload-pdf-disabled` | Material presign / commit | PDF attachments are switched off; same unsupported-format envelope (415), one refusal sentence, no new attachment or ingest. Existing committed replay remains committed. Script import is independent. |
| `material-upload-unsupported` | `POST /api/projects/[id]/material/presign` | The file's extension is not a format the source of record keeps (txt, md, docx, pdf, fdx, fountain). `VALIDATION.UNSUPPORTED_FORMAT` (`415`), permanent. |
| `material-upload-too-many` | `POST /api/projects/[id]/material/presign`, `POST /api/projects/[id]/material/[itemId]/commit` | The scope already holds its pending limit (30 per project, 30 per conversation — live, not withdrawn, not yet routed). `RATE_LIMIT.TOO_MANY_REQUESTS` (`429`) — "Too many files at once." Withdraw one first. Presign refuses early (before the key is recorded); the ENFORCED check is in the locked attach — at commit, and at presign for an item on a kept source (that one race-only refusal is recorded under the key). A commit refused there leaves its uploaded bytes to the age-gated orphan owner (never deleted while another in-flight commit could still name them). |
| `export-busy` | `POST /api/projects/[id]/export/backup` |: the export admission refused — the workspace already has a backup export running, this web process is at its build cap or its live-spool bytes, the workspace spent its hourly backup budget (`backup_export_workspace_hour`, MiB-costed on the pre-flight estimate), or the shared limiter is unreachable (fail closed). `RATE_LIMIT.CONCURRENT_LIMIT` (`429`) with `Retry-After` — "Export is busy. Try again in a moment." Nothing is read or spent for the refused export. |
| `material-upload-day-limit` | `POST /api/projects/[id]/material/presign` | The account (`material_bytes_day`, 250 MB) or the whole service (`material_kib_service_day`) presigned its daily attachment bytes (KiB-costed). `429` with `Retry-After` — "Upload limit reached for today." Decided before the idempotency key is recorded, so the same key may retry. |
| `material-upload-paused` | `POST /api/projects/[id]/material/presign` | The R2 breaker, the Class-A guard or the write-bytes guard (derived from the breaker's ceiling, below its trip) refuses, so no upload URL is issued and nothing is counted. `SYSTEM.SERVICE_UNAVAILABLE` (`503`), transient, `Retry-After` 30 s, never recorded under the idempotency key. |
| `material-upload-send-again` | `POST /api/projects/[id]/material/[itemId]/commit` | The upload did not arrive as signed: nothing staged, another length or ETag at the key, a source replaced before promotion, or an expired manifest with no committed item. `STATE.PREREQUISITE_NOT_MET` (`409`) — "This file didn't upload. Try adding it again." Presign again. |
| `material-upload-conflict` | `POST /api/projects/[id]/material/[itemId]/commit` | An item already exists under this id with a DIFFERENT manifest. `RESOURCE.ALREADY_EXISTS` (`409`), permanent. |
| `workspace-uploads-full` | `POST /api/intake/upload` | The WORKSPACE is already holding as many staged upload bytes as Nabu keeps at once — the per-workspace ceiling, which is a RESERVATION taken inside the carrier transaction under the per-workspace advisory lock (a measurement two concurrent uploads can both pass is not a bound), summing `intake_runs.source_bytes` over every row; the column is zeroed by the step that actually deletes the files — the abandoned-intake cleanup and a director's own project delete share one owner — so the ledger never credits bytes that are still on the volume. Served as `VALIDATION.TOO_LARGE` (`413`) with `details.field: 'storage'`, alongside the per-file `413` which carries no `reason` — the two are distinguishable by that token, and they call for different actions: a smaller FILE for the per-file cap, FEWER files for this one. Nothing is written: the check is the last gate before `fs.writeFile`, so a refused upload costs one indexed query and a `stat` per row. Added 2026-09-15; before it no storage quota was enforced anywhere in the product (`billing/types.ts`'s `maxProjects: 2` has zero call sites). |
| `pitch-regeneration-running` | `POST /api/projects/[id]/wizard/pitch-select` | A pitch regeneration is running for this project: the three directions on file are about to be replaced, so nothing is locked from them. `503`, `retryable: true` — the recoverable wizard `busy` answer; nothing was written and no stage moved. Read from the wizard state's own pitch run (`stageRuns.PITCH_GENERATION` pending / running), then from the queue's admission liveness for `pitch-generate` (a read that cannot answer refuses too). Retry once the regeneration has finished, then pick from the NEW directions (`GET /wizard/pitches`). The sibling refusal on the same route — a `directionId` that is no longer the direction at `selectedIndex` — is a `400` validation with `details { selectedIndex, directionId }` and no `reason`. |
| `pitches-not-generated` | `GET /api/projects/[id]/wizard/pitches` | No pitch list is on file for this project: the directions have not been generated. `404` `RESOURCE_NOT_FOUND` (`details.resourceType: 'Pitches'`); nothing to read. This marker is the ONLY proof of absence the route gives — the Direction step shows "No directions yet." (and its Regenerate) only for it; any other `404` (e.g. the project's) is a read that failed. A list on file that cannot be read is never this: it is a retryable `503` `SYSTEM_SERVICE_UNAVAILABLE` with no `reason`. |
| `pitch-base-open` | `POST /api/projects/[id]/wizard/pitch-select` | The chosen direction still has open questions: its pitch left a field of the story base unwritten (`dramaticQuestion`, `stakes`, `setting`, `cast`, `themes`) or proposed no `ending`. `400`; nothing was locked or written. `details.open` names the fields; `details.selectedIndex` and `details.directionId` name the direction. Pick again with the writer's answers in `base` / `ending`. |
| `pitch-base-not-open` | `POST /api/projects/[id]/wizard/pitch-select` | The pick's `base` answers a field the chosen direction already decided. `400`; nothing was locked or written. `details.fields` names those fields. Answer only the fields `pitch-base-open` named. |
| `series-blend-unsupported` | `POST /api/projects/[id]/wizard/pitch-select` | `mixNotes` was sent with a SERIES direction: the blend writes a film-shaped direction that would lock a show without its base, so a series direction is never blended. `400`; nothing was written and no stage moved. Pick the direction as it is (answer its open questions on the card) or regenerate the pitch. `details.selectedIndex` names the pick. |
| `series-kind-not-series` | `POST /api/projects/[id]/wizard/pitch-select` | The pick's `seriesKind` answers a direction that does not pitch a show: only a series direction has a kind of show. `400`; nothing was locked or written. Send `seriesKind` only for the series direction that asked for it. `details.selectedIndex` names the pick. |
| `show-step-open` | `POST /api/projects/[id]/wizard/synopsis/bootstrap`, `POST /api/projects/[id]/wizard/synopsis/skip` | A new TV pilot's series pitch is locked and its show page is open: the pilot starts only on the writer's Continue. `409` `STATE_PREREQUISITE_NOT_MET`; nothing was started. A driver acting for the writer sends the bootstrap with `{ fromShowStep: true }` (the Continue). |
| `series-blend-unsupported` | `POST /api/projects/[id]/wizard/pitch-select` | `mixNotes` asked to blend a SERIES direction. `400`; nothing was locked or written, no stage moved. Pick the direction as it is (answer its open questions) or regenerate the pitch. `details.selectedIndex` names the direction. |
| `series-kind-not-series` | `POST /api/projects/[id]/wizard/pitch-select` | The pick sent a `seriesKind` for a direction that does not pitch a show. `400`; nothing was locked or written. Send `seriesKind` only with a series direction. |
| `format-frozen-by-wizard` | `PUT /api/projects/[id]` | The script's format was set when its story was frozen in the wizard: a `format` different from that frozen one is refused with `409 STATE_INVALID_TRANSITION` (`details.frozenFormat`, `details.requestedFormat`) and nothing is written — the readers of the script (its acts, pacing, the exports, the editor through the project GET) answer from the frozen story, so the write would be acknowledged and then ignored. Change it by going back to "Your idea" in the wizard; sending the frozen format itself is accepted. |
| `basis-required` | `PUT /api/projects/[id]/scenes/[sceneId]` | A content write (`content` or `doc` in the body) arrived without the numeric `expectedContentVersion` it was read at: an editor, a rewriter or an agent's scene update must carry the version basis it read, so the write is refused before any read or write — the old last-writer-wins fallback is gone. `409` `STATE_STALE_CONTENT` with `details.expectedContentVersion: null` and a `hint`; nothing was written. Re-read the scene and send its `contentVersion` as `expectedContentVersion`. Metadata-only bodies need no basis. |
| `omitted` | `PUT /api/projects/[id]/scenes/[sceneId]` | A content write reached a scene that is omitted. `409` `STATE_STALE_CONTENT` with `details.currentContentVersion` and a reload `hint`; the content write was refused and the frozen scene is unchanged. Preserve the local edit and re-read the scene for recovery; retrying the same content while it remains omitted cannot save it. CLI adoption is tracked in. |
| `resume-needs-coordinator` | `POST /api/projects/[id]/ai/chat` (re-send body: `resumeMessageId`) | A re-send of a committed message arrived where this chat cannot guarantee ONE reply per message, so it was refused before anything was read, reserved or written. `409` `STATE_PREREQUISITE_NOT_MET` with `details.messageId`; permanent for this request — send the text as a new message instead. |

---

## Job wire strings are MACHINE-FACING (`job.error` / `job.result`)

The persisted `job.error` string and the `job.result` payload — surfaced on the jobs wire via
`GET /api/jobs/[jobId]` and the operations SSE stream — are **machine-facing terminal strings**, not
director copy. Two consumers depend on their raw shape:

1. **Terminality substrate.** The queue backends' `isNonRetryableQueueError` substring-matches
   `job.error` to decide retry-vs-terminal.
   Rewriting `job.error` into director copy would change retry/terminal semantics — the TC-1 funnel
   experiment proved this unsound (7 tested invariants broke) and was reverted (eb4079aa2).
2. **Agent / CLI diagnostics.** An agent or the CLI reads `job.error` / `job.result` to reason about
   a failed operation; a truncated raw cause is the useful signal there.

The vestigial (UNMOUNTED) `AIJobsPanel.tsx` — which read job records directly — was deleted in this
batch; the live director surface is `AIDrawer` (notification-mapper `entry.message`).

## `AuthRequiredError` → 401 (every wrapped route)

"Auth is on and this request has no valid session" (`AuthRequiredError`, thrown by
`getCurrentSessionOrThrow` / `getRequiredWorkspaceId`) is an **authentication** answer, not a
crash. `withErrorHandling` maps it to `401 Unauthorized` with
`AUTH_UNAUTHENTICATED` — deliberately the SAME code and envelope `requireSession` itself returns,
so a client that already knows how to re-authenticate on the guard's 401 needs no second branch.
(`AuthRequiredError.code` is `'AUTH_REQUIRED'`; that is the ERROR CLASS's internal tag and is NOT a
wire code — it is not in `REGISTERED_ERROR_CODES`.)

The response `message` is the guard's canonical sentence, never `error.message`: the thrown text can
carry operator mechanics (`Session has no workspace_id — user <id> may be an unhealed orphan`), which
must not reach a director or a client log.

**Also newly non-500 on this route:** `POST /api/user/preferences` answers `403
AUTH_INSUFFICIENT_PERMISSION` when the session carries no workspace binding (matching
`/api/billing/credits`), instead of throwing into the generic catch. No new error CODES were added,
so no CLI codegen is required; CLI clients should treat both as terminal-with-re-auth.

## `ArmedAdmissionReadError` → 503 (every wrapped route)

A transient armed authoritative-billing/admission READ outage under arm is **fail-closed but retryable**. The every-route wrapper
`withErrorHandling` maps it to `503 Service Unavailable` +
`Retry-After: 2`. The director-visible `message` is general calm copy ("We're finishing up a billing
check — wait a few seconds and try again."); the operator token `authoritative billing read` rides
`details.service` (serialized for telemetry, never the message — the pre-fix
`serviceUnavailable('authoritative billing read')` leaked it into the message). RAW (unwrapped) routes
normalize the same error to a `{ retry }` 503 via `resolveWizardDispatchBilling`. CLI clients should
treat this 503 as retryable and honor `Retry-After`.

## Chat-memory coordination refusal → 503 (chat send + every wrapped route)

A RECOVERABLE CHAT-MEMORY COORDINATION refusal — the re-arm interleave guard refusing every
chat-memory operation for a project whose conversation rows are mis-ordered on the id axis
(`ChatMemoryRearmInterleaveError`, `code: 'CHAT_MEMORY_REARM_INTERLEAVE'`) — is a repairable data
condition, not a crash and not a verdict about the request. `chatMemoryRefusalResponse`  maps it
to `503 Service Unavailable` + `Retry-After: 5`, wired into BOTH the every-route wrapper
`withErrorHandling` (universal floor) and `POST /api/projects/[id]/ai/chat`'s own catch — the route
where it actually lands, because the chat send persists the director's message before dispatching
the turn.

The director-visible `message` is the failure-copy sentence ("We're re-syncing this project's
conversation. Nothing you've written is lost — try again in a moment."), and `suggestedAction` comes
from the same SSOT. This class carries NO `details.service` token: `ApiError.toBody` strips only
`details.internal`, so a `service` noun is CLIENT-VISIBLE text — the class noun and the guard's raw
sentence (table names, the id floor, the repair script's command line) BOTH ride `internal`. Pre-fix
the route answered `500` with that raw sentence in `details.detail` plus a stack.

**`retryable: false`** — a chat send is not idempotent-on-retry, so a same-key idempotent replay is
served the cached 503 rather than blindly re-dispatching a turn (same reasoning as the non-wizard
project-lock class). CLI clients should surface the message and let the caller retry. **No new error code and no
route/shape change** — existing `SYSTEM_SERVICE_UNAVAILABLE` envelope — so CLI codegen is unaffected.
