coleam00/Archon · error

Failed to list dashboard runs: ${err.message}

Error message

Failed to list dashboard runs: ${err.message}

What it means

Thrown by the dashboard runs listing function when its composite query (filtered run list plus total/count aggregates) fails. The driver error is logged as `list_dashboard_runs_failed` and rethrown wrapped with this message. The function builds status-count aggregates and pagination on `remote_agent_workflow_runs`, so filter/sort clauses can also surface SQL errors here.

Source

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

    };
    for (const row of countResult.rows) {
      const n = Number(row.cnt);
      counts.all += n;
      if (row.status in counts) {
        counts[row.status as keyof Omit<typeof counts, 'all'>] = n;
      }
    }

    // Total for the current filter (with status applied)
    const total = options?.status
      ? (counts[options.status as keyof typeof counts] ?? 0)
      : counts.all;

    return { runs: listResult.rows.map(normalizeWorkflowRun), total, counts };
  } catch (error) {
    const err = error as Error;
    getLog().error({ err }, 'list_dashboard_runs_failed');
    throw new Error(`Failed to list dashboard runs: ${err.message}`);
  }
}

/**
 * List workflow runs with optional filters.
 */
export async function listWorkflowRuns(options?: {
  conversationId?: string;
  status?: WorkflowRunStatus | WorkflowRunStatus[];
  limit?: number;
  codebaseId?: string;
  /**
   * Non-enforcing "mine" filter: when set, restrict to runs attributed to this
   * user (`user_id = $N`). Absent → all runs (default visibility stays open).
   */
  userId?: string;
}): Promise<WorkflowRun[]> {
  const whereClauses: string[] = [];

View on GitHub (pinned to 0773b97458)

Solutions

  1. Check the `list_dashboard_runs_failed` log entry for the underlying driver error
  2. Verify database connectivity and that migrations are current for the deployed schema
  3. Reduce page size / add indexes if timeouts occur on large run tables
  4. Validate the filter arguments (statuses, dates) passed from the dashboard UI

Example fix

// before
const { runs, total } = await listDashboardRuns(filters); // throws on DB blip
// after
let data;
try {
  data = await listDashboardRuns(filters);
} catch (e) {
  data = { runs: [], total: 0, counts: emptyCounts }; // degraded dashboard
  logger.error({ err: e }, 'dashboard runs unavailable');
}
Defensive patterns

Strategy: fallback

Validate before calling

// validate filters before the call
const validStatuses = new Set(['running','paused','failed','completed','cancelled']);
if (filters.status && !validStatuses.has(filters.status)) throw new Error(`unsupported status filter: ${filters.status}`);

Type guard

function hasValidFilters(f: unknown): f is DashboardRunFilters {
  return typeof f === 'object' && f !== null &&
    (!('status' in f) || typeof (f as any).status === 'string' || (f as any).status == null);
}

Try / catch

let dashboard;
try {
  dashboard = await listDashboardRuns(filters);
} catch (error) {
  log.error({ err: error }, 'dashboard runs query failed; serving empty page');
  dashboard = { runs: [], total: 0, counts: {} };
}

Prevention

When it happens

Trigger: Calling listDashboardRuns with filter parameters while the DB is down, the generated WHERE/aggregate SQL is invalid for the configured engine, or the query times out under large datasets.

Common situations: Web dashboard load during a database outage or migration; a filter value producing invalid SQL for the dialect; slow queries timing out on very large run tables; read-replica lag or read-only replicas rejecting the query.

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


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