{"record":{"id":"c8e407844e280ccb","repo":"coleam00/Archon","slug":"failed-to-delete-workflow-run-err-message","errorCode":null,"errorMessage":"Failed to delete workflow run: ${err.message}","messagePattern":"Failed to delete workflow run: (.+?)","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"packages/core/src/db/workflows.ts","lineNumber":2143,"sourceCode":"      [id]\n    );\n    if (check.rows.length === 0) {\n      throw new WorkflowRunGuardError(`Workflow run not found: ${id}`);\n    }\n    if (!TERMINAL_WORKFLOW_STATUSES.includes(check.rows[0].status as WorkflowRunStatus)) {\n      throw new WorkflowRunGuardError(\n        `Cannot delete workflow run in '${check.rows[0].status}' status — cancel it first`\n      );\n    }\n    await pool.query('DELETE FROM remote_agent_workflow_events WHERE workflow_run_id = $1', [id]);\n    await pool.query('DELETE FROM remote_agent_workflow_runs WHERE id = $1', [id]);\n    await pool.query('COMMIT', []);\n  } catch (error) {\n    await rollback();\n    if (error instanceof WorkflowRunGuardError) throw error;\n    const err = error as Error;\n    getLog().error({ err, workflowRunId: id }, 'db.workflow_run_delete_failed');\n    throw new Error(`Failed to delete workflow run: ${err.message}`);\n  }\n}\n","sourceCodeStart":2125,"sourceCodeEnd":2146,"githubUrl":"https://github.com/coleam00/Archon/blob/0773b9745896ef0612e709c80845a0f7db315b19/packages/core/src/db/workflows.ts#L2125-L2146","documentation":"Error \"Failed to delete workflow run: ${err.message}\" thrown in coleam00/Archon.","triggerScenarios":"Thrown at packages/core/src/db/workflows.ts:2143 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"}