---
url: /reference/troubleshooting.md
---
# Troubleshooting

Common problems, each as the message Pandra prints, its cause, and the command that fixes it. A refused command lists every problem it found together and the commands that fix them, in order; with `--json`, the same comes as an [error document](/automate/output.md#errors). Placeholders such as `<commit>` stand for values Pandra prints in full. Every code is in [exit codes and errors](/reference/errors.md).

## A run stops before it starts

```text
error: github.com/acme/reviewer@v1.2.0 cannot start: 2 problems
  github.com/acme/reviewer@<commit> has not been approved
  --worktree needs a Git repository, and none contains /home/me
  To show what the agent contains:
    pandra agent inspect github.com/acme/reviewer@<commit>
  ...
  To run it in the current directory instead, without a worktree:
    pandra run github.com/acme/reviewer@<commit> --headless --prompt 'Review PR 12.'
```

**Cause.** Before the harness starts, Pandra checks everything it can ([what a run checks](/run/starting.md#what-a-run-checks)) and reports every problem at once. When a step approves the package, or the run must change to work, the last step is the run itself, pinned to the package it checked; otherwise, once the steps are done, run your command again.

**Fix.** Take the steps in order, then run the last one. To see the problems without starting anything:

```sh
pandra run github.com/acme/reviewer@v1.2.0 --dry-run
```

## The agent has not been approved

```text
error: github.com/acme/reviewer@v1.2.0 cannot start: 1 problem
  github.com/acme/reviewer@<commit> has not been approved
  ...
```

When an update adds an MCP server, changes what one runs or connects to, or lets a skill run a new tool without asking, the problem reads `github.com/acme/reviewer@<commit> changed since it was approved: this update lets skill fetch run Bash(curl:*) without asking`, and the problem's code is `package_changed`.

**Cause.** A remote agent or a package file runs only after you approve it. On a terminal the first run asks; without one, as in CI, the run fails.

**Fix.** Look at what the agent contains, then approve it:

```sh
pandra agent inspect github.com/acme/reviewer@v1.2.0
pandra agent trust github.com/acme/reviewer@v1.2.0
```

[Learn more about trusting agents →](/run/trust.md)

## An MCP server needs a value

```text
error: github.com/acme/reviewer@v1.2.0 cannot start: 2 problems
  MCP server "slack" of github.com/acme/reviewer needs input "tenant-id", which is not configured.
    Server:  com.slack/slack-mcp 2.0.0 (MCP Registry, registry.modelcontextprotocol.io)
    URL:     https://mcp.slack.com/mcp
    Input:   tenant-id: Slack workspace ID
  ...
```

**Cause.** The agent's servers ask for values, such as a token, that you have not configured. On a terminal, the run asks for them; without one, it fails.

**Fix.** Set them up ahead of time. On a terminal:

```sh
pandra config setup github.com/acme/reviewer@v1.2.0
```

Without a terminal, print a template, fill it in, and apply it:

```sh
pandra config setup github.com/acme/reviewer@v1.2.0 --template
pandra config setup github.com/acme/reviewer@v1.2.0 --file FILE
```

[Learn more about supplying values →](/mcp-servers/allowing.md#supplying-values)

## An MCP server did not connect

```text
warning: MCP server "slack" of github.com/acme/reviewer did not connect (Claude Code reported: failed); continuing without it.
  Server:  com.slack/slack-mcp 2.0.0 (MCP Registry, registry.modelcontextprotocol.io)
  URL:     https://mcp.slack.com/mcp
```

A server the agent marks `required` fails the run instead (`mcp_server_failed`): `error: required MCP server "slack" of ... did not connect (...); the prompt was not sent, so running again is safe.` A TUI run always opens, and the harness's interface shows each server's status.

**Cause.** The harness had not reported the server connected when Pandra's wait for MCP servers ended: up to 30 seconds, or 120 seconds when one runs from a package, whose first start downloads it. Servers that ask for a login (OAuth) never connect: Pandra does not support them yet.

**Fix.** Check the server's address and the values it receives, fix what is wrong, and run again:

```sh
pandra config show --agent github.com/acme/reviewer@v1.2.0
```

[Learn more about starting a run →](/run/starting.md)

## The harness is not installed, or there are several

```text
error: . cannot start: 1 problem
  no harness is installed; Pandra can install claude-code, codex, pi (runs in bypass or read-only)
  To install one of them:
    pandra harness install HARNESS
```

```text
error: several harnesses are installed (claude-code, codex); choose one with --harness
  To run it on the harness you choose:
    pandra run . --harness HARNESS --headless --prompt 'Review PR 12.'
```

**Cause.** Pandra uses the harness on `PATH`. With none, it offers to install one on a terminal and otherwise fails; with several, it asks on a terminal and otherwise fails with the list.

**Fix.** Install one, or choose one:

```sh
pandra harness install claude-code
pandra run github.com/acme/reviewer@v1.2.0 --harness claude-code --prompt "Review PR 12."
```

To stop being asked, set a default target ([choosing the harness and model](/harnesses/choosing.md)).

## The harness has no login

```text
Session:  861b7ed120c9 (reviewer)
error: the harness has no login to use
  To start Claude Code and sign in with /login, or set ANTHROPIC_API_KEY:
    /usr/local/bin/claude
```

**Cause.** The harness reported no credentials (`harness_not_logged_in`). Pandra reuses the login your harness already has; for Codex that is its `auth.json`, and a login kept only in the OS keyring is not shared with runs.

**Fix.** Sign in with the harness, as the step says. For Codex, set `cli_auth_credentials_store = "file"` in `~/.codex/config.toml`, then run:

```sh
codex login
```

[Learn more about Codex's login →](/harnesses/codex.md#login)

## A run refuses to skip permission checks

```text
error: . cannot start: 1 problem
  the harness refuses to skip permissions as root unless its environment variable IS_SANDBOX is exactly 1; to keep skipping them, run as a user other than root, or set IS_SANDBOX=1 if this machine is a sandbox (Pandra never sets it itself)
  To run it without skipping permissions:
    pandra run . --permission-mode auto --headless --prompt 'Fix the failing test.'
```

**Cause.** Claude Code refuses to skip permission checks as root unless `IS_SANDBOX=1` says the machine is a sandbox, so Pandra stops such a run before it starts.

**Fix.** To run with the harness's automatic review instead, take the step the error gives, which passes `--permission-mode auto`. When `bypass` comes from your configuration, the error also gives the `pandra config set` step that sets it back to `auto`. To keep skipping the checks in a container, run Pandra as a user other than root, or set `IS_SANDBOX=1` when the container is the sandbox:

```sh
env IS_SANDBOX=1 pandra run github.com/acme/reviewer@v1.2.0 --permission-mode bypass --prompt "Review PR 12."
```

[Learn more about permissions →](/harnesses/permissions.md)

## A Pi run will not start

```text
error: . cannot start: 1 problem
  pi has no permission mode auto; it runs in bypass or read-only
  To run on pi in read-only:
    pandra run . --harness pi --permission-mode read-only --headless --prompt 'Fix the failing test.'
  To run on pi with its permission checks skipped:
    pandra run . --harness pi --permission-mode bypass --headless --prompt 'Fix the failing test.'
```

**Cause.** Pi has no permission checks, so a Pi run starts only in `bypass` or `read-only`, and `auto` is the default.

**Fix.** Take one of the two steps, which choose the mode for one run: `read-only` lets Pi only read, and `bypass` lets it write and run commands. To set the mode for every Pi run that neither the option nor an agent setting decides:

```sh
pandra config set harnesses.pi.permission-mode bypass
```

[Learn more about Pi's permissions →](/harnesses/permissions.md#pi)

## An instructions file cannot be read

```text
$ pandra run . --prompt "Review the diff."
error: /home/me/.config/pandra/AGENTS.md: is not UTF-8
```

**Cause.** An instructions file that a run gets is not UTF-8, or cannot be read: the Pandra-level `AGENTS.md`, or a file that the `home` or `repo` source adds. It stops every run that gets it before anything starts.

**Fix.** Fix the file, or leave its source out of the run. `--instruction-sources` replaces the configured list for one run, so name the sources to keep, one per flag, such as `--instruction-sources home --instruction-sources repo` when the Pandra-level `AGENTS.md` is the broken file. `--instruction-sources none` leaves out every source:

```sh
pandra run . --prompt "Review the diff." --instruction-sources none
```

[Learn more about instructions and skills →](/configure/instructions-and-skills.md)

## The workspace cannot be used

```text
error: github.com/acme/reviewer@v1.2.0 cannot start: 1 problem
  the workspace /home/me/scratch does not exist
  To create the workspace directory:
    mkdir -p /home/me/scratch
```

```text
error: github.com/acme/reviewer@v1.2.0 cannot start: 1 problem
  --worktree needs a commit to start from, and the repository at /home/me/project has none yet
  To run it in the current directory instead, without a worktree:
    pandra run github.com/acme/reviewer@<commit> --headless --prompt 'Review PR 12.'
```

**Cause.** `--workspace DIR` needs an existing directory, and `--worktree` needs a Git repository that contains the current directory, has a commit, and has the `git` command available.

**Fix.** Create the directory, commit first, or run in the current directory, as the step says. [Workspaces](/run/workspaces.md#workspaces) lists the options.

## A session cannot be resumed

```text
error: session 34a06c46d9854c7ba7c22732aaf78688 is in use by run 820b865c7fd74ec48b2c84e542ce7ee7
```

```text
error: session bec0416e1aed4b6ba93531bdf0deb5f2 cannot be resumed: it ended before the harness started a conversation
  To remove the session, which cannot be resumed:
    pandra session remove bec0416e1aed4b6ba93531bdf0deb5f2
```

**Cause.** Another run owns the session, or the process that ran the session was killed before the harness created a conversation, which leaves the session `unavailable`.

**Fix.** For a session in use, wait for its run to end; `pandra ps` shows it as `active`. For one that cannot be resumed, remove it and start a new one, or resume the newest session that can be:

```sh
pandra ps -a
pandra session remove SESSION
```

[Learn more about sessions →](/run/workspaces.md#sessions)

## A session will not resume in read-only

```text
error: ~/.local/share/pandra/environments/homes/2ec6c8e1.../agents/writer.md would let the harness act beyond read-only; remove it, or run in auto
```

This sample shows only the error line and shortens its path.

**Cause.** The session's harness home holds a file or directory that lets the harness do more than `read-only` allows, such as a Claude Code subagent, command, or skill, a Codex rule, or a Pi extension, and Pandra did not put it there.

**Fix.** Remove what the message names, with the path from your own message:

```sh
rm -r PATH
```

On Claude Code or Codex, you can instead keep it and resume in `auto`, with `--permission-mode auto` for one run or with the agent's `permission-mode` set to `auto`.

[Learn more about read-only runs →](/harnesses/permissions.md#files-in-the-harness-home)

## A session record cannot be used

```text
warning: /home/me/.local/share/pandra/sessions/4c1be8dda6d2426589ec74e5f29ecfee/session.json: the session record cannot be used: invalid type: string \"yes\", expected a boolean
warning: /home/me/.local/share/pandra/sessions/9a0e3b7c51d84f2e8b6a1d0c4f7e2a95/session.json: the session record cannot be used: missing field `added_instructions`
  To remove the sessions whose records are of an older form:
    pandra session remove --force 4c1be8dda6d2426589ec74e5f29ecfee 9a0e3b7c51d84f2e8b6a1d0c4f7e2a95
```

```text
warning: /home/me/.local/share/pandra/sessions/b3d24a4ad3aa4b96b339be9f47aca1a7/session.json: the session record cannot be used: it was written by a newer version of pandra (record version 2)
```

**Cause.** `pandra ps` and the other commands that list sessions leave out a session whose record they cannot read, and warn about it. A record stays readable when it differs only by fields this version of Pandra does not know. The first two warnings are about records of an older form: each is the session's own record, of this record version or an older one, with a field that is missing, has another type or an old value, or breaks a rule of the record. The third is about a record that a newer Pandra wrote.

**Fix.** For the records of an older form, run the command under the last warning. It removes each session with its harness home and its generated workspace, but keeps a home or workspace that another session whose record Pandra can read still uses. It takes the sessions' full IDs, because a name or an ID prefix finds only sessions whose records can be read. Without `--force`, `pandra session remove` refuses such a session and prints the command with `--force`. If the removal stops part way, its error says what it removed. Fix what stopped it, such as a permission the error names, then run the command again with the IDs of the sessions that remain.

Pandra leaves every other session whose record it cannot use where it is, and no command removes it. For a record that a newer Pandra wrote, use that version of Pandra for the session.

When the workspace was a Git worktree, its branch and Git's entry for the worktree stay in your repository, because only the record names the repository. The removal warns about them:

```text
warning: session f6291a31b239473bbe5906f8d3a16ce3: its record cannot be read, so if its workspace was a Git worktree, its branch pandra/f6291a31b239 and Git's entry for the worktree stay in the worktree's repository. To drop the entry, with REPOSITORY the repository the worktree was made from:
  git -C REPOSITORY worktree remove --force --force /home/me/.local/share/pandra/workspaces/f6291a31b239
```

Run the command with your repository's path in place of `REPOSITORY`. To delete the branch too, with the name the warning gives, once you no longer need its commits:

```sh
git -C REPOSITORY branch -D pandra/f6291a31b239
```

[Learn more about sessions →](/run/workspaces.md#sessions)

## A guild member is not ready

```text
MEMBER             AGENT                                  DESCRIPTION                    READY  BLOCKERS
...
release-notes      github.com/acme/agents//release-notes  -                              no     agent_not_found
```

**Cause.** `pandra guild list` names each problem that stops a member under `BLOCKERS`. `READY` shows `no` for a remote member with a blocker, and `?` for a `path` member, which is built only when it runs.

**Fix.** Run the command for the blocker:

| Blocker | Command |
| --- | --- |
| `lockfile_missing` or `lockfile_stale` on a remote member | `pandra guild lock` |
| `agent_not_found` | `pandra guild pull` |
| `package_not_approved` | `pandra guild trust` |
| `lockfile_missing` or `lockfile_stale` on a `path` member | `pandra lock` in the member's directory |

[Learn more about pinning and approving →](/guilds/pinning.md)

## A quest record cannot be used

```text
warning: /home/me/.local/share/pandra/quests/18f7114da61143aa8e5908f885d3475f/quest.json: a record is invalid: missing field `definition`. To remove the quest once no process runs it any more:
  pandra quest remove --force 18f7114da61143aa8e5908f885d3475f
```

**Cause.** `pandra quest list` leaves out a quest whose record it cannot read, and warns about it. A warning that gives a command is about a record of an older form: the quest's own record, of this record version or an older one, with a field that is missing or cannot be used, such as a missing `definition`. A warning without a command is about any other record, such as one a newer Pandra wrote.

**Fix.** For a record of an older form, run the command the warning gives. It takes the quest's full ID, because an ID prefix finds only quests whose records can be read. Given that full ID, `quest wait`, `quest inspect`, `quest stop`, `quest logs`, `quest resume`, and `quest remove` without `--force` fail with `record_invalid`, name the same file, and print the same command. While another process still runs the quest, none of them prints the command, and `quest remove` fails with `quest_busy` instead, with or without `--force`. For a record that a newer Pandra wrote, use that version of Pandra for the quest.

The command removes the files Pandra keeps for the quest itself, such as its record, request, and output. The quest's sessions stay, and so do the workspace the quest created and a worktree's branch. To list the sessions under the quest's name and short ID, run `pandra guild ps -a` in the directory you ran `pandra quest run` in. If the guild file has moved since, the `Quest` line of `pandra session inspect SESSION` names the quest of each session that `pandra ps -a` lists. Remove the sessions with `pandra session remove`. The removal of the last one takes the workspace by the rules of [give the quest its own workspace](/quests/running.md#give-the-quest-its-own-workspace). A worktree that holds work stays, and `session remove` says why. Save the work elsewhere, such as files copied out or commits on a branch of your own, clear the uncommitted changes, and run `session remove` again, or discard the work with `pandra session remove --force`.

A workspace that no session works in any more stays, such as that of a quest whose steps were all commands. To remove it, follow these steps:

1. Set `W` to the workspace, `workspaces/<short quest ID>` in Pandra's data directory, with SHORT_ID the quest's short ID. Pandra uses `XDG_DATA_HOME` only when it is an absolute path, and `~/.local/share` otherwise:

   ```sh
   case "$XDG_DATA_HOME" in /*) D="$XDG_DATA_HOME" ;; *) D="$HOME/.local/share" ;; esac
   W="$D/pandra/workspaces/SHORT_ID"
   ```

2. Check that no session in `pandra ps -a --json` has `$W` as its `workspace`, and that its `warnings` name no session record that cannot be used. If either check fails, stop: a session may still work in `$W`.

3. Copy out of `$W` any work you want to keep, because the next step deletes it for good.

4. Delete a workspace that is not a worktree:

   ```sh
   rm -rf "$W"
   ```

   For a worktree, run these commands with REPOSITORY a checkout of the repository the quest ran in, such as the directory you ran `pandra quest run` in. Run the second command only when the branch holds nothing you want to keep:

   ```sh
   git -C REPOSITORY worktree remove --force --force "$W"
   git -C REPOSITORY branch -D pandra/SHORT_ID
   ```

## A remote agent cannot be fetched

```text
error: cannot fetch https://git.example.com/team/agents.git//reviewer@v1.2.0: the git command was not found on PATH; install Git 2.17 or later
```

```text
error: cannot fetch github.com/acme/reviewer@v1.2.0 with --offline; pull it online first
```

```text
error: github.com/acme/reviewer@v1.2.0 is not in the store; pull it first to see what it holds and approve it
  To fetch it into the store, then plan the run again:
    pandra pull github.com/acme/reviewer@v1.2.0
```

**Cause.** Git sources, builds inside a Git repository, and `--worktree` need the `git` command, Git 2.17 or later. `--offline` fetches nothing, so the agent must already be in your store. A dry run fetches a project's dependencies and a guild member's pinned package, but not a remote agent you name to `pandra run`, because pulling it shows what it holds before you approve it with `pandra agent trust`.

**Fix.** Install Git, or pull the agent online first:

```sh
pandra pull github.com/acme/reviewer@v1.2.0
```

## An agent started by an agent cannot read a secret

```text
error: secret "github-token" comes from 1Password, whose sign-in a nested run does not receive; give it a keychain or file source, or run it outside the agent
  To keep it in the keychain, which nested runs read:
    pandra --config-file /home/me/.config/pandra/config.toml config secret set github-token --keychain
```

**Cause.** A nested run does not see `PANDRA_SECRET_*` variables, the credentials that serve only a secret store, such as 1Password's sign-in, or the variable that its target's credential comes from, so a secret from those sources fails its checks with an error that names this limit.

**Fix.** Give the secret a keychain or file source. To keep it in the keychain, run the command the step gives in a shell of your own, outside the agent:

```sh
pandra --config-file /home/me/.config/pandra/config.toml config secret set github-token --keychain
```

[Learn more about agents that run agents →](/configure/agent-settings.md#agents-that-run-agents)
