{"record":{"id":"a5975342d0737473","repo":"coleam00/Archon","slug":"cannot-resolve-run-id-prefix-runid-outside-a","errorCode":null,"errorMessage":"Cannot resolve run id prefix '${runId}' outside a registered project.","messagePattern":"Cannot resolve run id prefix '(.+?)' outside a registered project\\.","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"packages/cli/src/commands/workflow.ts","lineNumber":4077,"sourceCode":" */\nasync function resolveRunIdArg(\n  runId: string,\n  cwd?: string,\n  requirePrefixMatch = false,\n  codebaseId?: string\n): Promise<string> {\n  if (FULL_RUN_ID_RE.test(runId)) return runId;\n  if (cwd === undefined && codebaseId === undefined) {\n    if (requirePrefixMatch) {\n      throw new Error(`Cannot resolve run id prefix '${runId}' without a project directory.`);\n    }\n    return runId;\n  }\n  const resolvedCodebaseId =\n    codebaseId ?? (cwd === undefined ? undefined : (await findCodebaseForCheckoutPath(cwd))?.id);\n  if (!resolvedCodebaseId) {\n    if (requirePrefixMatch) {\n      throw new Error(`Cannot resolve run id prefix '${runId}' outside a registered project.`);\n    }\n    return runId;\n  }\n  const matches = await workflowDb.findWorkflowRunsByIdPrefix(runId, resolvedCodebaseId);\n  if (matches.length > 1) {\n    const candidates = matches.map(match => `  ${match.id}`).join('\\n');\n    throw new Error(\n      `Run id '${runId}' matches more than one run in this project:\\n${candidates}\\nUse more characters or the full id.`\n    );\n  }\n  if (matches.length === 0) {\n    if (requirePrefixMatch) {\n      throw new Error(`No workflow run matches prefix '${runId}' in this project.`);\n    }\n    return runId;\n  }\n  return matches[0].id;\n}","sourceCodeStart":4059,"sourceCodeEnd":4095,"githubUrl":"https://github.com/coleam00/Archon/blob/0773b9745896ef0612e709c80845a0f7db315b19/packages/cli/src/commands/workflow.ts#L4059-L4095","documentation":"Variant of prefix resolution failure: a cwd was supplied (or implied) but findCodebaseForCheckoutPath returned no codebase — the directory is not a registered project — so the prefix cannot be scoped. Thrown only when requirePrefixMatch is set; otherwise the raw prefix is returned.","triggerScenarios":"`workflow get/resume/approve <short-prefix>` executed inside a directory that has never been registered with Archon (or whose registration row was deleted), with requirePrefixMatch enabled.","commonSituations":"Fresh clones without re-registration, moved/renamed checkout directories, deleted codebase rows, running in a worktree that was never registered.","solutions":["Register the current checkout: `archon project register` (from the checkout root).","Use the full run id instead of a prefix.","Verify the registration points at this exact path — registration is by checkout path, so a moved directory needs re-registration."],"exampleFix":"// before\narchon workflow resume ab12   # unregistered dir\n// after\narchon project register && archon workflow resume ab12","handlingStrategy":"validation","validationCode":"const reg = await findCodebaseForCheckoutPath(cwd).catch(() => null); if (!reg && !isFullRunId(id)) throw new Error('register this checkout or use the full run id');","typeGuard":null,"tryCatchPattern":"try { await resume(prefix); } catch (e) { if (String(e.message).includes('outside a registered project')) { execSync('archon project register'); await resume(prefix); } }","preventionTips":["Register every checkout (including worktrees) right after cloning.","Detect moved checkouts: if the directory path changed, re-register before using prefix ids.","Keep a mapping of run id -> project so scripts can cd to the right checkout first."],"tags":["cli","workflow","project-registration"],"backgroundTag":"unregistered-project","analyzedSha":"0773b9745896ef0612e709c80845a0f7db315b19","analyzedAt":"2026-09-01T02:28:07.064Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-08T05:18:18.240Z"}