{"record":{"id":"0f7ff02bc8c65e4c","repo":"coleam00/Archon","slug":"failed-to-get-workflow-run-err-message-0f7ff0","errorCode":null,"errorMessage":"Failed to get workflow run: ${err.message}","messagePattern":"Failed to get workflow run: (.+?)","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"packages/core/src/db/workflows.ts","lineNumber":455,"sourceCode":"  } catch (error) {\n    const err = error as Error;\n    getLog().error({ err }, 'db.workflow_run_create_failed');\n    throw new Error(`Failed to create workflow run: ${err.message}`);\n  }\n}\n\nexport async function getWorkflowRun(id: string): Promise<WorkflowRun | null> {\n  try {\n    const result = await pool.query<WorkflowRun>(\n      'SELECT * FROM remote_agent_workflow_runs WHERE id = $1',\n      [id]\n    );\n    const row = result.rows[0];\n    return row ? normalizeWorkflowRun(row) : null;\n  } catch (error) {\n    const err = error as Error;\n    getLog().error({ err }, 'db.workflow_run_get_failed');\n    throw new Error(`Failed to get workflow run: ${err.message}`);\n  }\n}\n\n/**\n * Find the workflow run that owns a container isolation environment\n * (`metadata.isolation_env_id === envId`, stamped at run creation for container\n * runs). Used by `isolation cleanup` to decide whether a container is reapable:\n * a paused/running run must NOT be pruned. Returns the newest match, or null when\n * no run references the env (an orphan safe to reap). Dialect-aware JSON extract.\n */\nexport async function getRunByIsolationEnvId(envId: string): Promise<WorkflowRun | null> {\n  const extract =\n    getDatabaseType() === 'postgresql'\n      ? \"metadata->>'isolation_env_id'\"\n      : \"json_extract(metadata, '$.isolation_env_id')\";\n  try {\n    const result = await pool.query<WorkflowRun>(\n      `SELECT * FROM remote_agent_workflow_runs","sourceCodeStart":437,"sourceCodeEnd":473,"githubUrl":"https://github.com/coleam00/Archon/blob/0773b9745896ef0612e709c80845a0f7db315b19/packages/core/src/db/workflows.ts#L437-L473","documentation":"Error \"Failed to get workflow run: ${err.message}\" thrown in coleam00/Archon.","triggerScenarios":"Thrown at packages/core/src/db/workflows.ts:455 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"}