coleam00/Archon · error
Failed to list due workflow continuations: ${err.message}
Error message
Failed to list due workflow continuations: ${err.message} What it means
Thrown by listDueWorkflowContinuations when the SELECT for time/deadline waits eligible for a resume claim fails. The query mixes dialect-specific JSON expressions (metadata->'wait' for Postgres, json_extract for SQLite) on `remote_agent_workflow_runs`; any driver/SQL failure is logged as `db.workflow_continuation_due_list_failed` and rethrown with this message. An empty result is not an error — only an actual query failure throws.
Source
Thrown at packages/core/src/db/workflows.ts:1566
const retryAt =
getDatabaseType() === 'postgresql'
? "metadata->>'continuation_retry_at'"
: "json_extract(metadata, '$.continuation_retry_at')";
try {
const result = await pool.query<WorkflowRun>(
`SELECT * FROM remote_agent_workflow_runs
WHERE (${retryAt} IS NULL OR ${retryAt} <= $1)
AND ((status = 'paused' AND (${signaledAt} IS NOT NULL OR ${resumeAt} <= $1))
OR (status = 'failed' AND ${scheduledResumeAt} <= $1 AND ${scheduledTriggeredAt} IS NULL))
ORDER BY COALESCE(${retryAt}, ${resumeAt}, ${scheduledResumeAt}) ASC
LIMIT $2`,
[now.toISOString(), limit]
);
return result.rows.map(normalizeWorkflowRun);
} catch (error) {
const err = error as Error;
getLog().error({ err }, 'db.workflow_continuation_due_list_failed');
throw new Error(`Failed to list due workflow continuations: ${err.message}`);
}
}
/** Back off a continuation that could not acquire execution prerequisites. */
export type WorkflowContinuationCursor = WorkflowResumeCursor;
export async function deferWorkflowContinuation(
id: string,
retryAt: string,
cursor: WorkflowContinuationCursor
): Promise<void> {
const dialect = getDialect();
const waitResumeAt =
getDatabaseType() === 'postgresql'
? "metadata->'wait'->>'resumeAt'"
: "json_extract(metadata, '$.wait.resumeAt')";
const scheduledResumeAt =
getDatabaseType() === 'postgresql'View on GitHub (pinned to 0773b97458)
Solutions
- Read the paired `db.workflow_continuation_due_list_failed` log for the driver-level cause
- Verify DB connectivity and pool health, then let the poller retry
- Confirm getDatabaseType() matches the deployed schema (Postgres vs SQLite JSON syntax)
- Validate metadata JSON integrity if extraction errors appear
Example fix
// before
const due = await listDueWorkflowContinuations(new Date(), 10); // throws on DB blip
// after
let due = [];
try {
due = await listDueWorkflowContinuations(new Date(), 10);
} catch (e) {
logger.warn({ err: e }, 'continuation scan skipped this tick');
} Defensive patterns
Strategy: retry
Validate before calling
// cheap pre-flight: is the DB reachable?
await getDatabase().query('SELECT 1'); Type guard
function isDueContinuationCandidate(run: WorkflowRun): boolean {
return run.status === 'paused' || run.status === 'failed';
} Try / catch
const due = await withRetry(
() => listDueWorkflowContinuations(now, limit),
{ retries: 3, backoffMs: 500, onRetry: (e, n) => log.warn({ e, n }, 'retrying continuation scan') }
); Prevention
- Run the continuation poller with tolerant retry/backoff around DB blips
- Keep run metadata JSON valid; validate before persisting
- Test after switching SQLite/Postgres so dialect expressions are exercised
- Alert on repeated `db.workflow_continuation_due_list_failed` events
When it happens
Trigger: Calling listDueWorkflowContinuations(now, limit) when the database is unreachable, the parameter types are rejected (e.g. now not serializing to ISO), or a dialect JSON-path expression is invalid for the configured engine.
Common situations: Database down or pool exhausted while the continuation poller runs; switching database types without migrating so JSON expressions no longer match; corrupted JSON in a metadata column making extraction fail on some engines.
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/5c3c83ffdf1e71c3.
Report an issue: GitHub.