{"record":{"id":"bdcab5992656849a","repo":"coleam00/Archon","slug":"workflow-run-is-not-an-engine-cancelled-fan-out-ch","errorCode":null,"errorMessage":"Workflow run is not an engine-cancelled fan-out child (id: ${id})","messagePattern":"Workflow run is not an engine-cancelled fan-out child \\(id: (.+?)\\)","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"packages/core/src/db/workflows.ts","lineNumber":1068,"sourceCode":"  const eventReason =\n    getDatabaseType() === 'postgresql' ? \"data->>'reason'\" : \"json_extract(data, '$.reason')\";\n\n  try {\n    return await getDatabase().withTransaction(async query => {\n      const result = await query(\n        `UPDATE remote_agent_workflow_runs\n         SET status = 'running',\n             completed_at = NULL,\n             started_at = ${dialect.now()},\n             last_activity_at = ${dialect.now()},\n             metadata = ${metadataWithoutCancelledReason}\n         WHERE id = $1\n           AND status = 'cancelled'\n           AND ${cancelledReason} IN ($2, $3, $4)`,\n        [id, ...FAN_OUT_CANCEL_REASONS]\n      );\n      if ((result.rowCount ?? 0) === 0) {\n        throw new Error(`Workflow run is not an engine-cancelled fan-out child (id: ${id})`);\n      }\n      await query(\n        `DELETE FROM remote_agent_workflow_events\n         WHERE workflow_run_id = $1\n           AND event_type = 'workflow_cancelled'\n           AND ${eventReason} IN ($2, $3, $4)`,\n        [id, ...FAN_OUT_CANCEL_REASONS]\n      );\n      const recovered = await query<WorkflowRun>(\n        'SELECT * FROM remote_agent_workflow_runs WHERE id = $1',\n        [id]\n      );\n      const row = recovered.rows[0];\n      if (!row) throw new Error(`Workflow run not found after fan-out recovery (id: ${id})`);\n      return normalizeWorkflowRun(row);\n    });\n  } catch (error) {\n    if (error instanceof Error && error.message.startsWith('Workflow run ')) throw error;","sourceCodeStart":1050,"sourceCodeEnd":1086,"githubUrl":"https://github.com/coleam00/Archon/blob/0773b9745896ef0612e709c80845a0f7db315b19/packages/core/src/db/workflows.ts#L1050-L1086","documentation":"Error \"Workflow run is not an engine-cancelled fan-out child (id: ${id})\" thrown in coleam00/Archon.","triggerScenarios":"Thrown at packages/core/src/db/workflows.ts:1068 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"}