diegosouzapw/OmniRoute · error

[OpenRouterProviderStats] Initial sync error:

Error message

[OpenRouterProviderStats] Initial sync error:

What it means

The promise returned by refreshOpenRouterProviderStats rejected with a thrown error during the initial sync (as opposed to a graceful non-ok result). Typically an unexpected exception such as a network fault or coding error escaping the refresh function. Non-fatal: startup continues and the periodic interval keeps retrying.

Solutions

  1. Read the logged error message to classify the exception
  2. Verify OpenRouter reachability and any API key configuration
  3. Rely on the periodic sync timer for automatic retries
Defensive patterns

Strategy: retry

When it happens

Trigger: Thrown at src/lib/catalog/openrouterProviderStats.ts:317 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/589643ab0de3ccef. Report an issue: GitHub.

Appendix: source

Thrown at src/lib/catalog/openrouterProviderStats.ts:317

function startPeriodicSync(intervalMs?: number): void {
  if (syncTimer) return; // Already running

  const interval = intervalMs ?? getTTL();
  console.log(`[OpenRouterProviderStats] Starting periodic sync every ${interval / 1000}s`);

  refreshOpenRouterProviderStats()
    .then((result) => {
      if (result.ok) {
        console.log(
          `[OpenRouterProviderStats] Initial sync complete: ${result.data.length} providers`
        );
      } else {
        console.warn(`[OpenRouterProviderStats] Initial sync failed: ${result.error}`);
      }
    })
    .catch((err) => {
      console.warn(
        "[OpenRouterProviderStats] Initial sync error:",
        err instanceof Error ? err.message : err
      );
    });

  syncTimer = setInterval(() => {
    refreshOpenRouterProviderStats().catch((err) => {
      console.warn(
        "[OpenRouterProviderStats] Periodic sync error:",
        err instanceof Error ? err.message : err
      );
    });
  }, interval);
  syncTimer.unref();
}

/**
 * Boot entry point — called once from instrumentation-node.ts.

View on GitHub (pinned to a179ffed5b)