{"record":{"id":"f7063d54d847f521","repo":"coleam00/Archon","slug":"cannot-action-repository-registration-failed","errorCode":null,"errorMessage":"Cannot ${action}: repository registration failed.\nError: ${error.message}\n${hint} (action='resume'; hint is 'Hint: Remove the stale workspace entry at ${staleWorkspaceEntry} and retry, or use --no-worktree to skip isolation.' or 'Hint: Check your Archon workspace registration under ${workspacesPath} and retry, or use --no-worktree to skip isolation.')","messagePattern":"Cannot (.+?): repository registration failed\\.\nError: (.+?)\n(.+?) \\(action='resume'; hint is 'Hint: Remove the stale workspace entry at (.+?) and retry, or use --no-worktree to skip isolation\\.' or 'Hint: Check your Archon workspace registration under (.+?) and retry, or use --no-worktree to skip isolation\\.'\\)","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"packages/cli/src/commands/workflow.ts","lineNumber":2370,"sourceCode":"      console.log(`Superseding run ${superseded.id} — fresh lane, provenance recorded.`);\n    }\n  }\n\n  // Handle --resume: locate the prior failed run, reuse its worktree, and hand\n  // the resumed-run handle to executeWorkflow below via opts. The executor no\n  // longer performs implicit resume detection on its own.\n  let resumable: WorkflowRun | null = null;\n  if (options.resume) {\n    if (!codebase) {\n      if (codebaseLookupError) {\n        throw new Error(\n          'Cannot resume: Database lookup failed.\\n' +\n            `Error: ${codebaseLookupError.message}\\n` +\n            'Hint: Check your database connection before using --resume.'\n        );\n      }\n      if (codebaseRegistrationError) {\n        throw buildRegistrationFailureError('resume', codebaseRegistrationError);\n      }\n      throw new Error(\n        'Cannot resume: Not in a git repository.\\n' +\n          'Either run from a git repo or use /clone first.'\n      );\n    }\n\n    if (resumeLookupError) {\n      throw buildResumeLookupFailureError(resumeLookupError);\n    }\n    // Resolved before discovery (top of this function), because the graph this run\n    // executes had to be chosen from it.\n    resumable = continuationRun ?? null;\n\n    if (!resumable) {\n      throw buildNoResumableRunError(workflowName, cwd);\n    }\n","sourceCodeStart":2352,"sourceCodeEnd":2388,"githubUrl":"https://github.com/coleam00/Archon/blob/0773b9745896ef0612e709c80845a0f7db315b19/packages/cli/src/commands/workflow.ts#L2352-L2388","documentation":"With --resume and no resolved codebase, if the codebase lookup succeeded but workspace/repository registration failed, the CLI throws buildRegistrationFailureError('resume', codebaseRegistrationError): 'Cannot resume: repository registration failed.\\nError: <detail>\\n' followed by a hint. The hint is either 'Remove the stale workspace entry at <staleWorkspaceEntry> and retry, or use --no-worktree to skip isolation.' or 'Check your Archon workspace registration under <workspacesPath> and retry, or use --no-worktree to skip isolation.' depending on whether a stale workspace entry was detected.","triggerScenarios":"Running `archon workflow run <name> --resume` where codebase is null, codebaseLookupError is null, but codebaseRegistrationError is set (workflow.ts:2369-2370) — resume requires the project identity, and registering the current git repository into the Archon workspace registry failed, e.g. because of a stale worktree/workspace entry or corrupt registration metadata under the workspaces path.","commonSituations":"Resuming after manually deleting a worktree directory that is still registered (stale entry); moving or renaming the checkout so the recorded path no longer matches; a corrupt ~/.archon workspace registry; conflicting registrations from parallel clones.","solutions":["Follow the printed hint: remove the stale workspace entry file/directory at the given path and retry the --resume command","If the recorded workspace path is wrong, fix or remove the registration under the printed workspaces path","Use --no-worktree to skip isolation if you intend to resume in place","Verify the current directory is the registered git repository checkout"],"exampleFix":"// before\narchon workflow run fix-issue --resume   // stale worktree entry\n// after\nrm -rf ~/.archon/workspaces/<stale-entry>\narchon workflow run fix-issue --resume","handlingStrategy":"try-catch","validationCode":"import { existsSync } from 'node:fs';\n// before `run --resume`, ensure no stale workspace entries remain\nconst wsDir = join(home, '.archon', 'workspaces');\nif (existsSync(wsDir)) {\n  for (const entry of readdirSync(wsDir)) {\n    const rec = JSON.parse(readFileSync(join(wsDir, entry), 'utf8'));\n    if (!existsSync(rec.path)) console.warn(`stale workspace entry: ${join(wsDir, entry)}`);\n  }\n}","typeGuard":null,"tryCatchPattern":"try {\n  await runWorkflow(name, { resume: true });\n} catch (e) {\n  const m = String(e.message);\n  if (m.includes('repository registration failed')) {\n    const stale = m.match(/stale workspace entry at (\\S+)/)?.[1];\n    if (stale) rmSync(stale, { recursive: true, force: true });\n    // else inspect the printed workspaces path; or retry with --no-worktree\n  } else throw e;\n}","preventionTips":["Never delete a run's worktree directory manually; let Archon clean it up or remove the matching workspace entry","Re-run registration after moving/renaming a checkout","Keep ~/.archon/workspace registry under version control awareness — inspect it before resuming","Use --no-worktree deliberately when resuming in place"],"tags":["cli","workspace-registration","resume","git"],"backgroundTag":"repository-registration-failed","analyzedSha":"0773b9745896ef0612e709c80845a0f7db315b19","analyzedAt":"2026-09-01T02:28:07.064Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-08T05:18:18.240Z"}