Skip to main content

Troubleshooting

Every error message on this page is output from the writ 0.1.0 tool. Search this page for the message you're looking at. The full list of exit codes, including 1, 8, 9, 10 and 130, is in the command reference.

Exit code 2 — validation error​

Something about the manifest, or the command's own input, is wrong. Nothing was minted, called, or spent.

Manifest structurally invalid (missing a required field):

Manifest invalid (1 problem(s)):
- mission is missing required field 'goal'.

Fix: add the missing field. writ validate lists every problem it finds, for example:

Manifest invalid (2 problem(s)):
- Top-level worker budgets sum to 40 sats, which exceeds budget.total_sats (0).
- budget.total_sats must be greater than 0 when the mission declares a paid (l402-http) capability; a zero or missing cap would allow unbounded spend.

A manifest that cannot be parsed at all reports the parse error alone.

File not found:

Manifest invalid (1 problem(s)):
- Manifest file not found: <your directory>/does-not-exist/mission.yaml
Manifest could not be read: Could not find a part of the path 'F:\...\mission.yaml'.

Fix: check the path. writ validate and writ run word the same problem differently; both mean the file isn't there.

Not valid YAML/JSON:

Manifest invalid (1 problem(s)):
- Manifest is not valid YAML/JSON: While parsing a flow sequence, did not find expected ',' or ']'.

Worker budgets exceed the mission cap:

Manifest invalid (1 problem(s)):
- Top-level worker budgets sum to 16 sats, which exceeds budget.total_sats (10).

A worker calls a capability outside its scope:

Manifest invalid (1 problem(s)):
- Worker 'w1' call step references capability 'c.d' which is not in the worker's scope.

Fix: add the capability to that worker's scope: list, or set expect_refusal: true on the step if the overreach is the point of the test.

A zero/missing budget on a mission with a paid capability:

Manifest invalid (1 problem(s)):
- budget.total_sats must be greater than 0 when the mission declares a paid (l402-http) capability; a zero or missing cap would allow unbounded spend.

Duplicate capability id:

Manifest invalid (1 problem(s)):
- Capability id 'a.b' is declared more than once.

An undeclared ${ENV} reference:

Manifest invalid (1 problem(s)):
- Manifest references environment variable '${SOME_VAR}' but it is not allowed to read it. Only two forms may be
interpolated: a name listed in the manifest's top-level 'env:' block (add 'env: [SOME_VAR]'), or a name prefixed
'WRIT_VAR_'. Anything else must be passed with --var.

Fix: add env: [SOME_VAR] to the manifest, prefix the variable WRIT_VAR_ in your shell, or (preferred) pass the value with --var.

A secret-shaped ${ENV} reference (refused even when declared):

Manifest invalid (1 problem(s)):
- Refusing to interpolate a sensitive environment variable '${MY_API_KEY}' into a manifest. Secret values (keys,
tokens, credentials) must never flow into a manifest field; declaring the name in 'env:' or prefixing it does
not change that. Use a non-secret variable or pass configuration via --var.

Fix: secrets never go into a manifest field. Read the secret in your own tooling instead of interpolating it into the mission file.

Missing a required --var:

Manifest invalid: Manifest references variable '{{target_name}}' but no --var target_name=... was supplied.

Fix: writ run mission.yaml --var target_name=....

Bad --var syntax:

--var must be name=value (was '<what you typed>').

writ revoke or writ reconcile without an audit key:

AuditKeyNotConfigured: WRIT_AUDIT_KEY is not set, and this command signs audit rows under it. Set WRIT_AUDIT_KEY to this host's audit key, or pass --development-audit-key to use the development audit key built into Writ, which is the same in every copy of Writ and proves nothing about who signed.

Fix: set WRIT_AUDIT_KEY to a secret you choose and keep, the same way as WRIT_ROOT_KEY in Approve and resume a run, end to end. Use --development-audit-key only for tests.

writ keys / writ record / writ approvals / writ revoke / writ reconcile input errors (a sample; all exit 2):

--operator-name is required: the identity record names who operates this key (it is published with every run).
Refusing to overwrite existing key file 'keys/receipt.key'. Use --out to create a new key at a different path.
No signer identity record at 'keys/signer-identity.json'. Run `writ keys init --operator-name <name>` to create a key + identity.
A run id is required.
No database found for run '<id>' at runs\<id>\writ.db.
Credential #9999 was not found in run '<id>'.
Could not approve #1: Approval request is already approved.
Could not deny #999: Approval request not found.
--resolve must be exactly 'paid' or 'not-paid' (was 'maybe').

Database schema error​

Every Writ database is stamped with a schema version. When writ approvals, writ revoke, writ reconcile, or a writ-mcp / writ-api host opens a database from an older Writ, it applies the known additive upgrades in order and carries on. It refuses, and changes nothing, in two cases:

Database schema error: This Writ database is at schema version 13, which is newer than this build of Writ understands (up to 12). It was written by a newer Writ release. ...
Database schema error: This database (schema version 0) cannot be upgraded to Writ schema version 12: table 'ApprovalRequests' is missing; ... It is either not a Writ database or it is damaged. Nothing was changed. ...

The first means a newer Writ release wrote the database: upgrade Writ to that release. The second means the file is not a Writ database, or it is damaged: point the host at a different database (WRIT_DB_PATH), or restore it from a backup. A service host reports the same messages as a configuration error at startup. Copy the database file, and its -wal and -shm files, before you upgrade Writ.

Exit code 3 — run failed​

The mission started but didn't complete. Check budget, execution, and authority first.

Agent model returned no usable response​

Worker 'researcher' agent model returned no usable response.

This appears when an agent-type step's LLM call fails or returns nothing usable. The log line before it gives the reason, for example, with model.provider: claude-cli:

warn: Writ.Engine.Llm.ClaudeCliLlmClient[0] claude CLI exited non-zero: ExitCode=1. Stderr (first 200 chars): ...

Confirm that claude --version works in the same shell, or use the anthropic provider (model.provider: anthropic + ANTHROPIC_API_KEY).

Agent response wasn't valid JSON:

Worker '<name>' agent response was not a valid tool/final JSON object: <parse error>.

Agent attempted a capability outside its scope:

Worker '<name>' agent attempted capability '<id>' outside its scope.

The model chose a capability its worker isn't scoped to. This is the authority engine doing its job — nothing to fix in the manifest unless you meant to grant that scope.

Unhandled run exception:

Run failed: <message>

writ run prints the message without a stack trace.

Exit code 4 — approval required​

The run suspended, not failed: a call crossed an approval threshold. Approve it, then continue the same run with writ resume. Approve and resume a run, end to end shows the setup a resumable run needs.

Suspended — pending approval #1. Approve with: writ approvals approve 1 --run <run-id>
Then continue the run with: writ resume <run-id> <manifest>
Spend requires human approval.

A run that started without WRIT_ROOT_KEY, or with a dev-ephemeral signer, cannot be resumed, and says what to set before you run the mission again:

Suspended — pending approval #1.
This run cannot be resumed: it started without WRIT_ROOT_KEY. To approve and continue a run, set WRIT_ROOT_KEY to a secret you keep and use work_record.signing: key-file (or env), then run the mission again.
Spend requires human approval.

Exit code 5 — verification failed​

writ verify found at least one problem. See Keys and verification for the full catalog with context; quick reference:

FAILED — <N> problem(s) across <M> receipt(s):
[row 0] <receiptId>: signature verification failed # wrong --pubkey
[row 0] <receiptId>: receiptHash does not match the recomputed canonical hash (tampered field) # tampered content
the run summary's terminal commitment signature does not verify under the supplied public key — refusing to trust it (the run summary may have been tampered with).
--require-identity: no signer identity record was found and the chain is not bound to one.
key <id> was revoked at <time> but <N> receipt(s) (first: sequence <n>, occurred <time>) were signed at/after that instant — not evidence.

writ verify requires --pubkey:

Option '--pubkey' is required.
Run `writ verify --help` for usage.

(exit 2, not 5: a missing required option is a usage error, not a verification failure.)

Exit code 8 — verification incomplete​

Every receipt verified, but nothing binds the end of the chain, so a shortened record would look the same:

INCOMPLETE — 1 receipt(s) verified, but no terminal commitment is available, so tail truncation cannot be ruled out.

Fix: verify the run directory or the exported bundle (which holds run.json), not work-record.jsonl on its own, or pass --expect-head or --pinned-head.

Exit code 6 — missing work record​

Every step ran, but the run's evidence is incomplete (outcome ExecutedReceiptPendingRecovery). Writ never reports this as clean success. run.json says which case you are in:

  • ReceiptsPendingRecovery: the receipt's request is staged in the run database. writ resume <run-id> <manifest> appends it, and the run then exits 0. If a resume leaves it pending, writ outbox list <run-id> says why; see staged work records that never replay.
  • WorkRecordExportError: the receipts are in the run database, but work-record.jsonl could not be written. writ resume re-exports it.
  • MissingReceipts with nothing staged: see the next section.

A receipt that was never staged​

If the store refused both the receipt and its staged request (for example, a full or failing disk at that instant), the payment still happened and is recorded. The signed receipt, however, cannot be reconstructed. The facts it would commit to, such as the output hash and the payment witness, were never written anywhere durable. Writ does not invent a receipt after the fact.

  • What it means: the invocation is settled in the ledger. When it paid, its payment hash and proven amount are on the invocation row (or in the signed proof journal <db>.proofs.jsonl). There is just no signed receipt in the chain for it.
  • No command clears it. Every later writ resume reads the gap from the ledger and keeps the run at exit 6. This is deliberate: the evidence really is incomplete.
  • Your evidence instead:
    • the run database's invocation and budget rows for that invocation id;
    • the signed audit log (invocation.proof_applied and related events);
    • the proof journal, if one was written;
    • your wallet's record of the payment hash.
  • Automation that gates on exit 6 should treat it as "work done, evidence incomplete". Do not re-run the mission to "fix" it, because a new run pays again. Do not retry the same call under a new idempotency key. Flag the run for a human, and record the invocation ids listed in MissingReceipts alongside it.

Staged work records that never replay​

Each staged request is authenticated by a key derived from the host's WRIT_ROOT_KEY, and is appended only when it verifies under the current key and matches the ledger. A service host (writ-mcp, writ-api) that ran without a persistent WRIT_ROOT_KEY, or whose key was rotated while records were pending, leaves records that a restart does not append; the host logs them once per start.

Setup that avoids it:

  • Run any host that stages receipts with a persistent WRIT_ROOT_KEY, and keep its database writable only by the host account.
  • Before replacing a host's root key, clear what the operator commands show: restart the host (or writ resume a run), run writ reconcile --service-db <path> --workspace <ws> and writ outbox list --service-db <path> --workspace <ws>, and clear what they list, because holds and records signed under the old key need the operator afterwards. Then rotate.

When records are already stuck, use writ outbox:

  1. Stop the host, or make sure no writ run / writ resume is running the run. Set WRIT_ROOT_KEY to the host's current key, and point the command at the same database path the host uses (its WRIT_DB_PATH) and the host's workspace (its WRIT_WORKSPACE, else default). If a command answers root_key_unrecognized while WRIT_ROOT_KEY is the host's key, restart the host so it records its key, then run the command again.
  2. List the records and why each is stuck. After a key change on a service database, read the previous key first (as in step 3) and pass it, so the list offers resign for each record that can be re-signed:
    writ outbox list --service-db <path> --workspace <ws> --previous-root-key-env WRIT_PREVIOUS_ROOT_KEY
    writ outbox list --service-db <path> --workspace <ws>
    writ outbox list <run-id>
  3. On a service database, re-sign a record this host staged under its earlier key. Read the host's previous WRIT_ROOT_KEY into an environment variable without echoing it or writing it to your shell history, then pass the variable's name. If the previous key was replaced because it may have been exposed, use discard, not resign.
    read -rs WRIT_PREVIOUS_ROOT_KEY && export WRIT_PREVIOUS_ROOT_KEY
    writ outbox resign --service-db <path> --workspace <ws> --invocation <id> --previous-root-key-env WRIT_PREVIOUS_ROOT_KEY
    In PowerShell:
    $env:WRIT_PREVIOUS_ROOT_KEY = Read-Host -MaskInput "Previous WRIT_ROOT_KEY"
    writ outbox resign --service-db <path> --workspace <ws> --invocation <id> --previous-root-key-env WRIT_PREVIOUS_ROOT_KEY
    The record is re-signed only when its own MAC verifies under the previous key, it matches the ledger, and, for a paid call, a proof event naming the same payment verifies under the current or the previous key. writ outbox list with the same --previous-root-key-env shows resign among a record's actions when these checks pass. Restart the host: it appends the receipt. If the previous key is gone, discard the record. A record_not_authenticated refusal that says the record carries a time later than the key change can happen when the host's clock was behind the previous host's when the key changed; discard that record.
  4. Discard a record you cannot explain, one the commands refuse, and any stranded record on a run (a run's key never changes, so such a record was not written by the run's own process):
    writ outbox discard --service-db <path> --workspace <ws> --invocation <id> --reason "staged under a key we no longer hold"
    writ outbox discard <run-id> --invocation <id> --reason "does not verify under the run key; not ours"
    The record is kept and the reason is recorded in the signed audit log. The next writ resume (or host start) appends a signed work_record_discarded receipt for it, and a run ends with exit 11.
  5. After rotating a service host's key, discard again any record you had discarded under the earlier key whose discard receipt is not yet on the chain: writ outbox list shows it pending again. A discard receipt already on the chain stays.

Exit code 11 — work records discarded by the operator​

Every step ran, at least one executed step has no signed work record, and the operator discarded each missing one with writ outbox discard (outcome ExecutedReceiptDiscarded). It is never clean success, and nothing is left for writ resume to append. Each discard is recorded in a signed receipt_outbox.discarded audit event; run.json keeps each invocation in MissingReceipts and lists it in DiscardedWorkRecords with the reason; and the resume appends a signed work_record_discarded receipt to the chain for each discard whose invocation and credential the ledger holds (writ outbox list shows which are on the chain). Treat it like exit 6: work done, evidence incomplete; do not re-run the mission.

Exit code 7 — pending reconciliation​

A wallet payment's outcome is unknown, and the budget hold is retained, not released or counted as spent. It is neither a success nor a failure. See Settlement and Approvals and budgets.

Invocation <N> is still pending reconciliation (payment hash <hash>, <sats> sats held): <reason>
Check the payment in your wallet by that hash, then run: writ reconcile <run-id> --invocation <N> --resolve paid|not-paid

writ reconcile --resolve not-paid also exits 7 when the wallet does not confirm that the payment failed, with a code: wallet_reports_paid, wallet_cannot_confirm, or no_lookup_wallet. See writ reconcile for what each one needs.

simulated settlement never produces this state.

Not an error: writ init refusing to overwrite​

Refusing to overwrite existing manifest: my-mission\mission.yaml

(exit 2.) writ init never overwrites a manifest you already have. Point it at a fresh directory, or edit the existing file directly.

Where to look next​