{"record":{"id":"5bc51ff4ff8b7d59","repo":"diegosouzapw/OmniRoute","slug":"openrouterproviderstats-initial-sync-failed-r","errorCode":null,"errorMessage":"[OpenRouterProviderStats] Initial sync failed: ${result.error}","messagePattern":"\\[OpenRouterProviderStats\\] Initial sync failed: (.+?)","errorType":"console","errorClass":null,"httpStatus":null,"severity":"error","filePath":"src/lib/catalog/openrouterProviderStats.ts","lineNumber":313,"sourceCode":"\nfunction getEffectiveOpenRouterProviderStatsEnabled(): boolean {\n  return process.env.OPENROUTER_PROVIDER_STATS_ENABLED !== \"false\";\n}\n\nfunction startPeriodicSync(intervalMs?: number): void {\n  if (syncTimer) return; // Already running\n\n  const interval = intervalMs ?? getTTL();\n  console.log(`[OpenRouterProviderStats] Starting periodic sync every ${interval / 1000}s`);\n\n  refreshOpenRouterProviderStats()\n    .then((result) => {\n      if (result.ok) {\n        console.log(\n          `[OpenRouterProviderStats] Initial sync complete: ${result.data.length} providers`\n        );\n      } else {\n        console.warn(`[OpenRouterProviderStats] Initial sync failed: ${result.error}`);\n      }\n    })\n    .catch((err) => {\n      console.warn(\n        \"[OpenRouterProviderStats] Initial sync error:\",\n        err instanceof Error ? err.message : err\n      );\n    });\n\n  syncTimer = setInterval(() => {\n    refreshOpenRouterProviderStats().catch((err) => {\n      console.warn(\n        \"[OpenRouterProviderStats] Periodic sync error:\",\n        err instanceof Error ? err.message : err\n      );\n    });\n  }, interval);\n  syncTimer.unref();","sourceCodeStart":295,"sourceCodeEnd":331,"githubUrl":"https://github.com/diegosouzapw/OmniRoute/blob/a179ffed5bb2e0b883b9ae7214ce8717b2a94c4d/src/lib/catalog/openrouterProviderStats.ts#L295-L331","documentation":"The initial OpenRouter provider-stats synchronization completed but returned a non-ok result, meaning the fetch/refresh of provider statistics from OpenRouter failed (e.g. network error, non-2xx upstream response, or parse failure). This is a soft failure: the periodic sync timer is still started, so cached/stale stats remain in use until a later sync succeeds.","triggerScenarios":"Thrown at src/lib/catalog/openrouterProviderStats.ts:313 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Check OpenRouter API availability and network egress from the server","Inspect result.error to identify whether it is an HTTP status, timeout, or parse failure","Wait for the next periodic sync tick to retry automatically"],"exampleFix":null,"handlingStrategy":"retry","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"a179ffed5bb2e0b883b9ae7214ce8717b2a94c4d","analyzedAt":"2026-08-25T18:35:09.898Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}