{"record":{"id":"0d3bf0be142204fe","repo":"coleam00/Archon","slug":"cannot-resolve-the-project-for-adopt-supersede","errorCode":null,"errorMessage":"Cannot resolve the project for --adopt/--supersedes. Run from the project checkout and try again.","messagePattern":"Cannot resolve the project for --adopt/--supersedes\\. Run from the project checkout and try again\\.","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"packages/cli/src/commands/workflow.ts","lineNumber":2048,"sourceCode":"      assertCodebaseResolvedForIsolation(detachResolved);\n    }\n    // Never pin a worktree branch on the child for a folder project. The --folder flag\n    // declares it; an already-registered folder project is read off the resolution.\n    const detachIsFolder = options.folder === true || detachCodebase?.kind === 'folder';\n    // Surface worktree-option conflicts synchronously in the parent rather than\n    // letting the child fail after fork.\n    assertNoWorktreeOptionsForFolder(detachIsFolder, options);\n\n    // Between-run continuation (#2747): refuse an unresolvable declaration HERE — this\n    // is the exact failure that vanished into a child log. `resolveWorkflowAdoption` is\n    // pure resolution with no filesystem or database mutation, so running it as a\n    // pre-flight costs nothing and the child still re-resolves it against the live\n    // checkout when it starts (its lane binds a worktree this process never touches).\n    let adoptedRunId: string | undefined;\n    let supersededRunId: string | undefined;\n    if (options.adoptRunId !== undefined || options.supersedesRunId !== undefined) {\n      if (!detachCodebase) {\n        throw new Error(\n          'Cannot resolve the project for --adopt/--supersedes. Run from the project checkout and try again.'\n        );\n      }\n      if (options.adoptRunId !== undefined) {\n        adoptedRunId = await resolveRunIdArg(options.adoptRunId, cwd, false, detachCodebase.id);\n        await resolveWorkflowAdoption({\n          adoptedRunId,\n          codebaseId: detachCodebase.id,\n          codebasePath: detachCodebase.default_cwd,\n          codebaseKind: detachCodebase.kind,\n          containerRequested: options.container === true,\n        });\n      } else if (options.supersedesRunId !== undefined) {\n        supersededRunId = await resolveRunIdArg(\n          options.supersedesRunId,\n          cwd,\n          false,\n          detachCodebase.id","sourceCodeStart":2030,"sourceCodeEnd":2066,"githubUrl":"https://github.com/coleam00/Archon/blob/0773b9745896ef0612e709c80845a0f7db315b19/packages/cli/src/commands/workflow.ts#L2030-L2066","documentation":"`--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.","triggerScenarios":"Running `archon workflow start <name> --adopt <runId>` (or `--supersedes <runId>`) from a directory outside the project checkout, so detachCodebase is undefined at the preflight.","commonSituations":"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.","solutions":["cd into the project's checkout and re-run the command.","Verify your Archon config points at the correct project/codebase for the current directory.","Re-check that the run ID you are adopting belongs to this project — a mismatch can surface as unresolvable project context."],"exampleFix":"// before (anywhere)\narchon workflow start code-review --adopt run_123\n// after\ncd ~/projects/my-app && archon workflow start code-review --adopt run_123","handlingStrategy":"try-catch","validationCode":"// confirm you are inside a project checkout before adopting\nif (!Bun.file('.git').exists && !Bun.file('.git/HEAD').exists) {\n  throw new Error('Run --adopt/--supersedes from within the project checkout.');\n}","typeGuard":null,"tryCatchPattern":"try {\n  await runWorkflowStart(args);\n} catch (err) {\n  if (err instanceof Error && err.message.includes('Cannot resolve the project')) {\n    console.error('cd into the project checkout and retry.');\n    process.exit(2);\n  }\n  throw err;\n}","preventionTips":["Always run adopt/supersede commands from the project working directory.","Verify `archon` project/codebase config resolves for your cwd before scripting adopt flows.","Include the cwd in script logs so failed adoptions are diagnosable."],"tags":["cli","project-resolution","adopt","environment"],"backgroundTag":"project-context-unresolved","analyzedSha":"0773b9745896ef0612e709c80845a0f7db315b19","analyzedAt":"2026-09-01T02:28:07.064Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-08T05:18:18.240Z"}