coleam00/Archon · error

Failed to clean up old workflow runs: ${err.message}

Error message

Failed to clean up old workflow runs: ${err.message}

What it means

Error "Failed to clean up old workflow runs: ${err.message}" thrown in coleam00/Archon.

Source

Thrown at packages/core/src/db/workflows.ts:2111

        SELECT id FROM remote_agent_workflow_runs
        WHERE status IN ('completed', 'failed', 'cancelled')
          AND started_at < ${cutoff}
      )`,
      []
    );
    const result = await pool.query(
      `DELETE FROM remote_agent_workflow_runs
       WHERE status IN ('completed', 'failed', 'cancelled')
         AND started_at < ${cutoff}`,
      []
    );
    await pool.query('COMMIT', []);
    return { count: result.rowCount ?? 0 };
  } catch (error) {
    await rollback();
    const err = error as Error;
    getLog().error({ err, olderThanDays }, 'db.workflow_runs_cleanup_failed');
    throw new Error(`Failed to clean up old workflow runs: ${err.message}`);
  }
}

/**
 * Delete a workflow run and its associated events.
 * Only terminal runs (completed, failed, cancelled) can be deleted.
 */
export async function deleteWorkflowRun(id: string): Promise<void> {
  try {
    await pool.query('BEGIN', []);
    // Guard: verify run exists and is terminal before deleting
    const check = await pool.query<{ status: string }>(
      'SELECT status FROM remote_agent_workflow_runs WHERE id = $1',
      [id]
    );
    if (check.rows.length === 0) {
      throw new WorkflowRunGuardError(`Workflow run not found: ${id}`);
    }

View on GitHub (pinned to 0773b97458)

When it happens

Trigger: Thrown at packages/core/src/db/workflows.ts:2111 when the library encounters an invalid state.

Common situations: See trigger scenarios.


AI-assisted analysis of coleam00/Archon@0773b97458 (2026-09-01). Data as JSON: /api/errors/21f0b061daf90e0a. Report an issue: GitHub.