diegosouzapw/OmniRoute · error

[OpenRouterProviderStats] Periodic sync error:

Error message

[OpenRouterProviderStats] Periodic sync error:

What it means

A periodic (setInterval-driven) refresh of OpenRouter provider stats threw an exception. One background tick failed; previously synced stats remain served from cache and the next interval tick will retry. It does not affect request serving directly, only freshness of provider statistics.

Solutions

  1. Check for transient upstream/network issues with OpenRouter
  2. Look for repeated occurrences to distinguish persistent outage from one-off failure
  3. Confirm OPENROUTER_PROVIDER_STATS_ENABLED and TTL settings are sensible
Defensive patterns

Strategy: retry

When it happens

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

Appendix: source

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

    .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.
 * On by default; opt out via OPENROUTER_PROVIDER_STATS_ENABLED=false.
 */
export function initOpenRouterProviderStatsSync(): boolean {
  if (!getEffectiveOpenRouterProviderStatsEnabled()) {
    console.log("[OpenRouterProviderStats] Disabled via OPENROUTER_PROVIDER_STATS_ENABLED=false.");
    return false;
  }
  startPeriodicSync();

View on GitHub (pinned to a179ffed5b)