{"record":{"id":"36704fd8557994b5","repo":"coleam00/Archon","slug":"cannot-supersede-no-workflow-run-runid-exist","errorCode":null,"errorMessage":"Cannot supersede: no workflow run '${runId}' exists.","messagePattern":"Cannot supersede: no workflow run '(.+?)' exists\\.","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"packages/cli/src/commands/workflow.ts","lineNumber":739,"sourceCode":"function buildResumeLookupFailureError(error: Error): Error {\n  return new Error(\n    'Cannot resume: Database lookup failed.\\n' +\n      `Error: ${error.message}\\n` +\n      'Hint: Check your database connection before using --resume.'\n  );\n}\n\n/**\n * Validate a `--supersedes` declaration (#2747): the run must exist and be terminal.\n * Supersede inherits nothing, so existence and terminality are the whole contract.\n *\n * One owner for the refusals because two callers need them: the `--detach` pre-flight,\n * which refuses before forking (#2872), and the run path that records the provenance.\n */\nasync function resolveSupersededRun(runId: string): Promise<WorkflowRun> {\n  const superseded = await workflowDb.getWorkflowRun(runId);\n  if (!superseded) {\n    throw new Error(`Cannot supersede: no workflow run '${runId}' exists.`);\n  }\n  if (!TERMINAL_WORKFLOW_STATUSES.includes(superseded.status)) {\n    throw new Error(`Cannot supersede run '${superseded.id}': it is still ${superseded.status}.`);\n  }\n  return superseded;\n}\n\n/**\n * The acting CLI user's Archon id, or undefined when `ARCHON_USER_ID`/`$USER` is unset\n * or the identity cannot be resolved. Attribution is best-effort by design — a run must\n * not fail because the user table could not be reached.\n */\nasync function resolveCliUserRecordId(): Promise<string | undefined> {\n  const cliId = resolveCliUserId();\n  if (!cliId) return undefined;\n  try {\n    const cliUser = await userDb.findOrCreateUserByPlatformIdentity('cli', cliId, cliId);\n    return cliUser.id;","sourceCodeStart":721,"sourceCodeEnd":757,"githubUrl":"https://github.com/coleam00/Archon/blob/0773b9745896ef0612e709c80845a0f7db315b19/packages/cli/src/commands/workflow.ts#L721-L757","documentation":"resolveSupersededRun() resolves the run named by a supersede option (--supersede) before starting a new run. getWorkflowRun returned null, meaning no workflow run with that id exists in the database, so the CLI refuses. Both the --detach pre-flight and the provenance-recording path share this owner (#2872).","triggerScenarios":"Passing --supersede <runId> where runId is a typo, belongs to a different install/database, references a run that was deleted, or is an id from another id space (e.g. a session or task id instead of a workflow run id).","commonSituations":"Copy-paste truncating the run id; switching databases (dev vs production) so the id is unknown; trying to supersede a run on another machine's install; using an old id after the DB was reset.","solutions":["List existing runs (`archon runs` / `archon workflow list`) and copy the exact run id.","Confirm you are pointed at the same database the original run used.","If you only want to start a new run, drop the --supersede flag instead."],"exampleFix":"// before (truncated id)\n$ archon workflow run foo --supersede wf_a1b2\nError: Cannot supersede: no workflow run 'wf_a1b2' exists.\n// after (full id from `archon workflow list`)\n$ archon workflow run foo --supersede wf_a1b2c3d4e5f6","handlingStrategy":"validation","validationCode":"// check the id exists before passing --supersede\nimport { workflowDb } from '@archon/core';\nconst run = await workflowDb.getWorkflowRun(runId);\nif (!run) throw new Error(`--supersede id not found: ${runId}`);","typeGuard":null,"tryCatchPattern":"try {\n  await runWorkflow(name, { supersede: runId });\n} catch (e) {\n  if (String((e as Error).message).includes('no workflow run')) {\n    console.error(`Run id ${runId} not found; list runs and copy the exact id.`);\n  }\n}","preventionTips":["Copy run ids from `archon workflow list` output, never retype them.","Ensure you are on the same install/database that created the run.","Drop --supersede entirely when you simply want a fresh run."],"tags":["cli","workflow-run","lookup-failed","identifier"],"backgroundTag":"entity-not-found","analyzedSha":"0773b9745896ef0612e709c80845a0f7db315b19","analyzedAt":"2026-09-01T02:28:07.064Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-08T05:18:18.240Z"}