> For AI agents: the complete documentation index is available at https://docs.phax.run/llms.txt, the full documentation bundle is available at https://docs.phax.run/llms-full.txt.

# When something goes wrong

## Troubleshooting \{#troubleshooting}

- **`claude` not found.** Install Claude Code and make sure `claude` is on your `$PATH`; `phax agent probe` lists what phax finds.

- **A gate keeps failing.** The run pauses once the fix attempts are spent. Read the attempt logs, `~/.phax/runs/<namespace>.<name>/phase-NN/checks-attempt-NN.log`. Attempts are numbered once per phase: a resumed phase continues at the next number and never overwrites an earlier attempt's files, so the last attempt is the highest-numbered `checks-attempt-NN.log`. Fix the cause (or raise `agent.maxFixAttempts`), then `phax resume <run> --yes`, which runs the gate again first. To start the phase over instead, `phax reset-phase <run> --yes` before resuming.

- **Lock conflict.** Another phax is working on that run, or one died; `phax unlock <run>` clears a stale lock.

- **The handoff is missing.** The phase ended in `handoff_failed`: `phax enter-phase <run> <phase-id>` takes you back into its session (`phax enter` opens only the final phase's). See [When a run stops](https://docs.phax.run/guide/run.md#when-a-run-stops).

- **A rate or usage limit.** The run stopped at exit 8 and keeps its place: `phax resume <run> --yes` when the limit resets.

- **A failed agent session.** A command printed `✗ <provider> session failed (<kind>): …` with the files to read: the cause, `agent-error.log` and the transcript. Read [Troubleshooting a failed agent session](https://docs.phax.run/guide/agent-session-failures.md) to tell whether to retry, resume or fix something.

- **Exit 14: the provider could not be reached.** The network was down. Retry the printed command once it is back; a paused run lists as `rate_limited` and continues with `phax resume <run> --yes` straight away, in a new provider session in the same worktree. A Codex session keeps waiting for the network instead of ending: interrupt it, then resume. A record refused right after it (`following the failed session`) was a consequence of the outage, and the retry writes it. See [Troubleshooting a failed agent session](https://docs.phax.run/guide/agent-session-failures.md).

- **Records refused: the visibility could not be determined.** The refusal quotes `gh`'s own first line. For a network failure, retry once the network is back; for an authentication failure, run `gh auth login`, then retry. Only for another reason (no GitHub remote, say) set `records.destination.acknowledgedUnknownVisibility` once you have confirmed the repository is private.

- **A plan with a source spec is refused for lacking `completes-spec`.** A plan whose `source-spec` names a spec must carry `completes-spec: true` (its run completes the spec) or `false` (more plans follow); `plans lint`, `artifact approve` and `run` refuse it with exit 12. Add the key by hand, then re-approve an Approved plan, since changing the value makes it stale. A headless plan's older `.json` sidecar lacks `completesSpec` too: re-author or delete it.

- **Approval records are per-artifact files.** Approval records were one shared ledger per kind; each is now a file of its own under `docs/plans/approvals/` and `docs/specs/approvals/`. After upgrading, `phax artifact approve` and `phax run` refuse with exit 12 while `docs/plans/approvals.json` or `docs/specs/approvals.json` exists. Run the one-time migration, which splits both ledgers into record files in one commit:

  ```console
  $ phax artifact approve docs/plans/2610051200-foo-plan.md
  ✗ docs/plans/approvals.json is an approval ledger from an older phax — run `phax artifact migrate-approvals` first
  $ phax artifact migrate-approvals
  docs/plans/approvals.json → 1 record file
    docs/plans/approvals/2606291247-smolvm-isolation-spike-plan.json
  committed a1b2c3d chore(approvals): migrate approval ledgers to record files
  $ phax artifact approve docs/plans/2610051200-foo-plan.md   # now writes docs/plans/approvals/2610051200-foo-plan.json
  ```

- **Approvals name their approver.** `phax artifact approve` and `phax artifact reopen` now take `--by operator` or `--by machine:<grant>` (a kebab-case slug). Without a terminal they refuse with exit 12 unless given `--by`, so add it to scripts and loops; from a terminal the default is the operator, named as git commits (`GIT_COMMITTER_NAME`, else `user.name`), and an operator approval with neither set refuses. New approval records carry `approvedBy`; records written earlier read as `unattributed` and are never rewritten by a read.

- **Spec and plan documents carry questions.** A spec or plan can hold open and arbitrated questions, each named by id, and `phax artifact status` prints a `Questions:` line counting them. After upgrading, run `phax artifact migrate-documents` once in the main checkout: `phax artifact approve` and `phax artifact reopen` refuse with exit 12 until every live headless sidecar is at its current shape. The command rewrites each older sidecar, re-renders its body keeping the frontmatter, and commits exactly what it wrote in one commit. It refuses, writing nothing, on an invalid sidecar, on a body that is not its sidecar's own rendering (a hand edit would be overwritten), or on an uncommitted change to a path it would write. It names the Approved artifacts it leaves edited since approval, with their open question ids, and the plans it leaves stale. A spec question whose rationale opens with `Decided by the author on <date>` becomes arbitrated, lifted and unattributed; every other question stays open. `abandon` is not refused. `complete` (exit 12) and run completion refuse only a current-shape spec still holding a summary placeholder. Each surface element of a spec now carries a `summary`: a sidecar stamped below 0.27.0, or written before `$schema`, is lifted with a placeholder on every element, `migrate-documents` restamps it and counts the summaries to write per spec, and `approve` and `complete` refuse a spec until every placeholder is replaced.

- **`migrate-documents` refuses a plan whose test strategy is prose.** A plan document now holds each phase's test strategy as test lines. A plan sidecar stamped 0.26.0 or below whose every test strategy line follows the line format is lifted to those lines; one holding prose is refused with exit 12, writing nothing, naming the phase and its first departing line:

  ```console
  $ phax artifact migrate-documents
  ✗ migrate refused: docs/plans/2610230951-interactive-phases-plan.md phase-01 testStrategy line 1 departs from the test line format: "Write `tests/unit/hold.test.ts` first."
    Rewrite each phase's test strategy in the line format, in the sidecar and plan.md alike, or re-author the plan, then rerun.
  ```

  Each line reads `- <guarantee> — <size> · <technique> · <oracle> · <loop>[ · <criterion>]`, one per line under the phase's `### Test strategy` heading, or a lone `- (none)`.

Something else? `phax report <run>` opens a GitHub issue with the run's telemetry.
