{"record":{"id":"cb4cef4b24a19a28","repo":"coleam00/Archon","slug":"terminal-workflow-status-requestedstatus-requ","errorCode":null,"errorMessage":"Terminal workflow status '${requestedStatus}' requires a lifecycle writer","messagePattern":"Terminal workflow status '(.+?)' requires a lifecycle writer","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"packages/core/src/db/workflows.ts","lineNumber":1135,"sourceCode":"/**\n * Partially update non-terminal workflow state. Terminal transitions use their\n * dedicated lifecycle writers so the run row cannot outpace its durable event.\n */\nexport async function updateWorkflowRun(\n  id: string,\n  updates: Partial<Pick<WorkflowRun, 'metadata' | 'output_root'>> & {\n    status?: Exclude<WorkflowRunStatus, 'completed' | 'failed' | 'cancelled'>;\n    outcome?: WorkflowRunOutcome;\n    working_path?: string;\n  }\n): Promise<void> {\n  const dialect = getDialect();\n  const setClauses: string[] = [];\n  const values: unknown[] = [];\n  const requestedStatus: WorkflowRunStatus | undefined = updates.status;\n\n  if (requestedStatus !== undefined && TERMINAL_WORKFLOW_STATUSES.includes(requestedStatus)) {\n    throw new Error(`Terminal workflow status '${requestedStatus}' requires a lifecycle writer`);\n  }\n\n  if (requestedStatus !== undefined) {\n    values.push(requestedStatus);\n    setClauses.push(`status = $${values.length}`);\n  }\n  if (updates.metadata !== undefined) {\n    // Use dialect helper for JSON merge - need to calculate the param index\n    const paramIndex = values.length + 1;\n    values.push(JSON.stringify(updates.metadata));\n    setClauses.push(`metadata = ${dialect.jsonMerge('metadata', paramIndex)}`);\n  }\n  if (updates.outcome !== undefined) {\n    values.push(updates.outcome);\n    setClauses.push(`outcome = $${values.length}`);\n  }\n  if (updates.output_root !== undefined) {\n    values.push(updates.output_root);","sourceCodeStart":1117,"sourceCodeEnd":1153,"githubUrl":"https://github.com/coleam00/Archon/blob/0773b9745896ef0612e709c80845a0f7db315b19/packages/core/src/db/workflows.ts#L1117-L1153","documentation":"Error \"Terminal workflow status '${requestedStatus}' requires a lifecycle writer\" thrown in coleam00/Archon.","triggerScenarios":"Thrown at packages/core/src/db/workflows.ts:1135 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":[],"exampleFix":null,"handlingStrategy":null,"validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"0773b9745896ef0612e709c80845a0f7db315b19","analyzedAt":"2026-09-01T02:28:07.064Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-08T05:18:18.240Z"}