diegosouzapw/OmniRoute · error

[ARENA_ELO_SYNC] Failed to delete expired intelligence

Error message

[ARENA_ELO_SYNC] Failed to delete expired intelligence: ${message}

What it means

Non-fatal warning inside syncArenaElo's pre-write cleanup: deleteExpiredIntelligence() threw while pruning stale arena intelligence rows, and the sync deliberately continues writing fresh entries rather than aborting. The message identifies the DB-level prune failure only.

Solutions

  1. Check DB write permissions/locks on the intelligence table
  2. Ignore for transient SQLite busy errors
  3. Run a manual sync after fixing to force cleanup
Defensive patterns

Strategy: try-catch

When it happens

Trigger: Thrown at src/lib/arenaEloSync.ts:390 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/e48fb15a35fe3ccb. Report an issue: GitHub.

Appendix: source

Thrown at src/lib/arenaEloSync.ts:390

      source: "arena_elo",
      error: "Sync already in progress",
    };
  }
  syncInProgress = true;
  try {
    // Backup DB before first sync (same pattern as pricingSync)
    if (!firstSyncDone && !dryRun) {
      backupDbFile("pre-arena-elo-sync");
      firstSyncDone = true;
    }

    // Clean up stale entries before writing new ones
    if (!dryRun) {
      try {
        deleteExpiredIntelligence();
      } catch (err) {
        const message = err instanceof Error ? err.message : String(err);
        console.warn(`[ARENA_ELO_SYNC] Failed to delete expired intelligence: ${message}`);
      }
    }

    const leaderboards = await fetchArenaLeaderboards();
    const entries = transformToModelIntelligence(leaderboards);

    if (!dryRun && entries.length > 0) {
      try {
        bulkUpsertModelIntelligence(entries);
      } catch (err) {
        const message = err instanceof Error ? err.message : String(err);
        console.warn(`[ARENA_ELO_SYNC] Failed to bulk upsert intelligence: ${message}`);
        return {
          success: false,
          modelCount: 0,
          source: "arena_elo",
          error: message,
        };

View on GitHub (pinned to a179ffed5b)