coleam00/Archon · error
Failed to list workflow runs: ${err.message}
Error message
Failed to list workflow runs: ${err.message} What it means
Thrown by listWorkflowRuns when the filtered SELECT over `remote_agent_workflow_runs` fails. Driver/SQL errors are logged as `db.workflow_run_list_failed` and rethrown with this message. Empty results are normal; only an actual query failure throws.
Source
Thrown at packages/core/src/db/workflows.ts:1974
);
}
const limit = options?.limit ?? 50;
values.push(limit);
const limitParam = `$${String(values.length)}`;
const whereStr = whereClauses.length > 0 ? `WHERE ${whereClauses.join(' AND ')}` : '';
try {
const result = await pool.query<WorkflowRun>(
`SELECT * FROM remote_agent_workflow_runs ${whereStr} ORDER BY started_at DESC LIMIT ${limitParam}`,
values
);
return result.rows.map(normalizeWorkflowRun);
} catch (error) {
const err = error as Error;
getLog().error({ err }, 'db.workflow_run_list_failed');
throw new Error(`Failed to list workflow runs: ${err.message}`);
}
}
/**
* The open-work inbox (#2747): runs that ended with work on the table. Status-
* derived v1 semantics — terminal AND failed AND no run has adopted or
* superseded it (the NOT EXISTS closes the row behaviorally when a successor
* claims it). Deletion is hard in this store, so "not deleted" holds by
* construction. Paused/waiting/cancelled runs are excluded by design: they are
* live or already judged.
*/
export async function findOpenWorkRuns(options?: {
codebaseId?: string;
limit?: number;
}): Promise<WorkflowRun[]> {
const values: unknown[] = [];
let codebaseClause = '';
if (options?.codebaseId) {View on GitHub (pinned to 0773b97458)
Solutions
- Inspect the `db.workflow_run_list_failed` log for the driver-level cause
- Verify DB connectivity and schema/migration state
- Check the filter object values (statuses, run ids, dates) are among the supported ones
- Retry after transient connection failures
Example fix
// before
const runs = await listWorkflowRuns({ status: 'running' }); // throws on DB failure
// after
try {
const runs = await listWorkflowRuns({ status: 'running' });
} catch (e) {
logger.error({ err: e }, 'could not list workflow runs — is the database reachable?');
process.exitCode = 1;
} Defensive patterns
Strategy: try-catch
Validate before calling
// validate filter values before querying
const allowed = new Set(['running','paused','failed','completed','cancelled']);
if (filters?.status && !allowed.has(filters.status)) {
throw new Error(`unsupported status filter: ${filters.status}`);
} Type guard
function isRunListFilters(f: unknown): f is { status?: string; limit?: number } {
if (typeof f !== 'object' || f === null) return false;
const o = f as Record<string, unknown>;
return (o.status === undefined || typeof o.status === 'string') &&
(o.limit === undefined || typeof o.limit === 'number');
} Try / catch
try {
const runs = await listWorkflowRuns(filters);
render(runs);
} catch (error) {
log.error({ err: error }, 'failed to list workflow runs — check database connectivity');
exit(1);
} Prevention
- Verify DB connectivity before CLI commands that list runs
- Keep schema migrations current after engine switches
- Validate filters against the supported set at the command boundary
- Monitor `db.workflow_run_list_failed` for recurring driver issues
When it happens
Trigger: Calling listWorkflowRuns with filters when the DB is unreachable, a filter parameter type is rejected by the driver, or the dynamically built WHERE/ORDER SQL is invalid for the configured dialect.
Common situations: CLI `workflow list` during a database outage; passing an unsupported status/filter value that reaches the SQL layer; schema not migrated after switching engines; connection pool exhaustion.
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/06e2f5e6fd8ec409.
Report an issue: GitHub.