coleam00/Archon · error · Error

Cannot resolve the project for --adopt/--supersedes. Run fro

Error message

Cannot resolve the project for --adopt/--supersedes. Run from the project checkout and try again.

What it means

`--adopt` and `--supersedes` must resolve the target run's project from the current checkout, which requires the detached codebase handle (detachCodebase) to be available. When the CLI cannot resolve the project — typically because it is not running inside a project checkout — it aborts the adoption/supersession preflight with this error instead of guessing.

Source

Thrown at packages/cli/src/commands/workflow.ts:2048

      assertCodebaseResolvedForIsolation(detachResolved);
    }
    // Never pin a worktree branch on the child for a folder project. The --folder flag
    // declares it; an already-registered folder project is read off the resolution.
    const detachIsFolder = options.folder === true || detachCodebase?.kind === 'folder';
    // Surface worktree-option conflicts synchronously in the parent rather than
    // letting the child fail after fork.
    assertNoWorktreeOptionsForFolder(detachIsFolder, options);

    // Between-run continuation (#2747): refuse an unresolvable declaration HERE — this
    // is the exact failure that vanished into a child log. `resolveWorkflowAdoption` is
    // pure resolution with no filesystem or database mutation, so running it as a
    // pre-flight costs nothing and the child still re-resolves it against the live
    // checkout when it starts (its lane binds a worktree this process never touches).
    let adoptedRunId: string | undefined;
    let supersededRunId: string | undefined;
    if (options.adoptRunId !== undefined || options.supersedesRunId !== undefined) {
      if (!detachCodebase) {
        throw new Error(
          'Cannot resolve the project for --adopt/--supersedes. Run from the project checkout and try again.'
        );
      }
      if (options.adoptRunId !== undefined) {
        adoptedRunId = await resolveRunIdArg(options.adoptRunId, cwd, false, detachCodebase.id);
        await resolveWorkflowAdoption({
          adoptedRunId,
          codebaseId: detachCodebase.id,
          codebasePath: detachCodebase.default_cwd,
          codebaseKind: detachCodebase.kind,
          containerRequested: options.container === true,
        });
      } else if (options.supersedesRunId !== undefined) {
        supersededRunId = await resolveRunIdArg(
          options.supersedesRunId,
          cwd,
          false,
          detachCodebase.id

View on GitHub (pinned to 0773b97458)

Solutions

  1. cd into the project's checkout and re-run the command.
  2. Verify your Archon config points at the correct project/codebase for the current directory.
  3. Re-check that the run ID you are adopting belongs to this project — a mismatch can surface as unresolvable project context.

Example fix

// before (anywhere)
archon workflow start code-review --adopt run_123
// after
cd ~/projects/my-app && archon workflow start code-review --adopt run_123
Defensive patterns

Strategy: try-catch

Validate before calling

// confirm you are inside a project checkout before adopting
if (!Bun.file('.git').exists && !Bun.file('.git/HEAD').exists) {
  throw new Error('Run --adopt/--supersedes from within the project checkout.');
}

Try / catch

try {
  await runWorkflowStart(args);
} catch (err) {
  if (err instanceof Error && err.message.includes('Cannot resolve the project')) {
    console.error('cd into the project checkout and retry.');
    process.exit(2);
  }
  throw err;
}

Prevention

When it happens

Trigger: Running `archon workflow start <name> --adopt <runId>` (or `--supersedes <runId>`) from a directory outside the project checkout, so detachCodebase is undefined at the preflight.

Common situations: Issuing adopt/supersede commands from $HOME or a unrelated repo while the Archon daemon points elsewhere; running the CLI in a container whose working directory is not a project checkout.

Related errors


AI-assisted analysis of coleam00/Archon@0773b97458 (2026-09-01). Data as JSON: /api/errors/0d3bf0be142204fe. Report an issue: GitHub.