coleam00/Archon · error
Failed to list open workflow runs: ${err.message}
Error message
Failed to list open workflow runs: ${err.message} What it means
Thrown by the open-work inbox listing (#2747) when its status-derived query (terminal, failed, unadopted runs) fails. Errors are logged as `db.workflow_open_work_list_failed` and rethrown with this message. An empty inbox is a normal result; only a query failure throws.
Source
Thrown at packages/core/src/db/workflows.ts:2017
try {
const result = await pool.query<WorkflowRun>(
`SELECT * FROM remote_agent_workflow_runs r
WHERE r.status = 'failed'
${codebaseClause}
AND NOT EXISTS (
SELECT 1 FROM remote_agent_workflow_runs a
WHERE a.adopted_from_run_id = r.id
)
ORDER BY r.started_at DESC
LIMIT ${limitParam}`,
values
);
return result.rows.map(normalizeWorkflowRun);
} catch (error) {
const err = error as Error;
getLog().error({ err }, 'db.workflow_open_work_list_failed');
throw new Error(`Failed to list open workflow runs: ${err.message}`);
}
}
/**
* Runs that adopted or superseded `runId` (#2747) — the reverse direction of
* `adopted_from_run_id`, same column, no second column. Newest first.
*/
export async function findAdoptingRuns(runId: string): Promise<WorkflowRun[]> {
try {
const result = await pool.query<WorkflowRun>(
'SELECT * FROM remote_agent_workflow_runs WHERE adopted_from_run_id = $1 ORDER BY started_at DESC',
[runId]
);
return result.rows.map(normalizeWorkflowRun);
} catch (error) {
const err = error as Error;
getLog().error({ err, runId }, 'db.workflow_run_adopters_lookup_failed');
throw new Error(`Failed to find adopting runs: ${err.message}`);View on GitHub (pinned to 0773b97458)
Solutions
- Check the `db.workflow_open_work_list_failed` log entry for the real driver error
- Verify database connectivity and that the deployed schema matches the configured engine
- Add/refresh indexes if the open-work scan times out on large history
- Retry after transient failures — the listing is read-only and safe to re-run
Example fix
// before
const open = await listOpenWorkflowRuns(); // throws on DB failure
// after
let open = [];
try {
open = await listOpenWorkflowRuns();
} catch (e) {
logger.error({ err: e }, 'open-work inbox unavailable');
} Defensive patterns
Strategy: fallback
Validate before calling
// pre-flight reachability check
await getDatabase().query('SELECT 1'); Type guard
function isWorkflowRunArray(v: unknown): v is WorkflowRun[] {
return Array.isArray(v) && v.every(r => typeof r === 'object' && r !== null && 'id' in r);
} Try / catch
let openRuns: WorkflowRun[] = [];
try {
openRuns = await listOpenWorkflowRuns();
} catch (error) {
log.error({ err: error }, 'open-work inbox query failed; showing empty inbox');
} Prevention
- Ensure indexes support the open-work status-derivation predicate
- Keep engines and schema aligned; retest after SQLite/Postgres switches
- Refresh statistics/vacuum as run history grows to avoid scan timeouts
- Track `db.workflow_open_work_list_failed` events as inbox health
When it happens
Trigger: Calling the open-work list function when the database connection fails, the status-derivation SQL errors for the configured dialect, or the query times out on large tables.
Common situations: Opening the open-work inbox view during a database outage or migration drift; dialect mismatch in status-derivation expressions; slow full scans timing out as run history grows.
Understand the failure class
Background: Database query failed: Internal Server Error 500s wrapping SQL, Prisma, and connection failures — what to check first — this error's family across 16 libraries.
Related errors
- Failed to get workflow run: ${err.message}
- Workflow run '${runId}' references codebase '${codebaseId}',
- Failed to load codebase '${codebaseId}' for workflow run '${
- Failed to complete workflow run: ${err.message}
- Workflow run not found or not in running state (id: ${id})
AI-assisted analysis of coleam00/Archon@0773b97458 (2026-09-01).
Data as JSON: /api/errors/77ea533699ef9735.
Report an issue: GitHub.