{"record":{"id":"bae7990b998d0f1a","repo":"coleam00/Archon","slug":"cannot-resume-run-with-status-run-status-onl","errorCode":null,"errorMessage":"Cannot resume run with status '${run.status}'. Only failed or paused runs can be resumed.","messagePattern":"Cannot resume run with status '(.+?)'\\. Only failed or paused runs can be resumed\\.","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"packages/core/src/operations/workflow-operations.ts","lineNumber":398,"sourceCode":"/**\n * List all running and paused workflow runs.\n */\nexport async function getWorkflowStatus(): Promise<WorkflowStatusData> {\n  const runs = await workflowDb.listWorkflowRuns({\n    status: ['running', 'paused'],\n    limit: 50,\n  });\n  return { runs };\n}\n\n/**\n * Validate that a run can be resumed and return it.\n * Does NOT execute the workflow — callers decide whether to run.\n */\nexport async function resumeWorkflow(runId: string): Promise<WorkflowRun> {\n  const run = await getRunOrThrow(runId, 'operations.workflow_resume_lookup_failed');\n  if (!RESUMABLE_WORKFLOW_STATUSES.includes(run.status)) {\n    throw new Error(\n      `Cannot resume run with status '${run.status}'. Only failed or paused runs can be resumed.`\n    );\n  }\n  return run;\n}\n\nexport interface AbandonWorkflowResult {\n  run: WorkflowRun;\n  /** Whether this call won the state transition to `cancelled`. */\n  cancelled: boolean;\n  /**\n   * Number of sub-run descendants the cascade failed to cancel (best-effort walk;\n   * failures are also logged). Non-zero means part of the tree may still be alive.\n   */\n  cascadeFailures: number;\n  /**\n   * When the abandoned run was itself a `workflow:` sub-run and its parent is\n   * paused blocked on it: the parent's run id. Nothing auto-resumes that parent","sourceCodeStart":380,"sourceCodeEnd":416,"githubUrl":"https://github.com/coleam00/Archon/blob/0773b9745896ef0612e709c80845a0f7db315b19/packages/core/src/operations/workflow-operations.ts#L380-L416","documentation":"resumeWorkflow validates that a run can be resumed before executing it. Only 'failed' and 'paused' runs are in RESUMABLE_WORKFLOW_STATUSES; any other status (running, completed, cancelled, etc.) has no execution point to resume from, so the library throws rather than corrupting run state.","triggerScenarios":"Calling resumeWorkflow (directly or via the 'run'/'resumed' commands) with a run ID whose status is 'running', 'completed', or 'cancelled'.","commonSituations":"Resuming an already-completed run from a stale task list; attempting to kick a run that is currently executing; retrying a resume command that already succeeded; a cancelled run referenced by an old automation script.","solutions":["Check the run's status first and only call resumeWorkflow when status is 'failed' or 'paused'.","If the run already completed, start a new run instead of resuming.","If the run is currently 'running', wait for it to finish; use cancel/abandon if it must stop.","A cancelled run is terminal — start a fresh run rather than resuming."],"exampleFix":"// before\nawait resumeWorkflow(runId);\n// after\nconst run = await getRunOrThrow(runId);\nif (run.status === 'failed' || run.status === 'paused') {\n  await resumeWorkflow(runId);\n}","handlingStrategy":"validation","validationCode":"const RESUMABLE = ['failed', 'paused'];\nconst run = await getRun(runId);\nif (!RESUMABLE.includes(run.status)) throw new Error(`Run ${runId} (${run.status}) is not resumable`);","typeGuard":"function isResumable(run: WorkflowRun): boolean {\n  return run.status === 'failed' || run.status === 'paused';\n}","tryCatchPattern":"try { await resumeWorkflow(runId); }\ncatch (e) {\n  if ((e as Error).message.startsWith(\"Cannot resume run with status\")) {\n    console.warn(`Not resumable: ${(e as Error).message}`);\n  } else throw e;\n}","preventionTips":["Check status right before resuming; refresh stale run listings.","Start new runs for completed/cancelled work instead of resuming.","Guard automation retry loops with a resumable-status predicate."],"tags":["workflow","resume","state-machine"],"backgroundTag":"invalid-state-transition","analyzedSha":"0773b9745896ef0612e709c80845a0f7db315b19","analyzedAt":"2026-09-01T02:28:07.064Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-08T05:18:18.240Z"}