diegosouzapw/OmniRoute · error

[DB] Failed to verify provider_connections schema:

Error message

[DB] Failed to verify provider_connections schema:

What it means

Error "[DB] Failed to verify provider_connections schema:" thrown in diegosouzapw/OmniRoute.

Source

Thrown at src/lib/db/schemaColumns.ts:88

    // `refresh_token` is part of 001_initial_schema.sql, but `CREATE TABLE IF NOT EXISTS`
    // is a no-op on a pre-existing legacy table that predates it — heal it defensively
    // before the index below relies on it, or a very old DB fails startup entirely.
    if (!columnNames.has("refresh_token")) {
      db.exec("ALTER TABLE provider_connections ADD COLUMN refresh_token TEXT");
      console.log("[DB] Added provider_connections.refresh_token column");
    }
    db.exec(
      "CREATE INDEX IF NOT EXISTS idx_pc_max_concurrent ON provider_connections(provider, max_concurrent)"
    );
    db.exec(
      "CREATE INDEX IF NOT EXISTS idx_pc_auth_active_refresh ON provider_connections(auth_type, is_active, refresh_token)"
    );
    db.exec(
      "CREATE INDEX IF NOT EXISTS idx_pc_provider_auth_type ON provider_connections(provider, auth_type)"
    );
  } catch (error: unknown) {
    const message = error instanceof Error ? error.message : String(error);
    console.warn("[DB] Failed to verify provider_connections schema:", message);
  }
}

export function ensureUsageHistoryAccountIndex(db: SqliteDatabase) {
  try {
    db.exec("CREATE INDEX IF NOT EXISTS idx_uh_account_key ON usage_history(account_key)");
  } catch (error: unknown) {
    const message = error instanceof Error ? error.message : String(error);
    console.warn("[DB] Failed to verify usage_history account index:", message);
  }
}

export function ensureUsageHistoryColumns(db: SqliteDatabase) {
  try {
    const columns = db.prepare("PRAGMA table_info(usage_history)").all() as Array<{
      name?: string;
    }>;
    const columnNames = new Set(columns.map((column) => String(column.name ?? "")));

View on GitHub (pinned to a179ffed5b)

When it happens

Trigger: Thrown at src/lib/db/schemaColumns.ts:88 when the library encounters an invalid state.

Common situations: See trigger scenarios.


AI-assisted analysis of diegosouzapw/OmniRoute@a179ffed5b (2026-08-25). Data as JSON: /api/errors/6432e58eeb8cb880. Report an issue: GitHub.