{"record":{"id":"013fd2f22d1a3425","repo":"diegosouzapw/OmniRoute","slug":"openroutercatalog-fetch-failed-using-stale-cach","errorCode":null,"errorMessage":"[OpenRouterCatalog] Fetch failed, using stale cache:","messagePattern":"\\[OpenRouterCatalog\\] Fetch failed, using stale cache:","errorType":"console","errorClass":null,"httpStatus":null,"severity":"error","filePath":"src/lib/catalog/openrouterCatalog.ts","lineNumber":144,"sourceCode":"  if (cache && cache.fetchedAt) {\n    const age = now - new Date(cache.fetchedAt).getTime();\n    if (age < ttl) {\n      return {\n        data: cache.data,\n        stale: false,\n        cachedAt: cache.fetchedAt,\n        fromCache: true,\n      };\n    }\n  }\n\n  // Cache expired or missing — attempt fresh fetch\n  try {\n    const data = await fetchFromAPI();\n    writeCache(data);\n    return { data, stale: false, cachedAt: null, fromCache: false };\n  } catch (err) {\n    console.warn(\"[OpenRouterCatalog] Fetch failed, using stale cache:\", err);\n\n    // Stale-if-error: return old cache if available\n    if (cache) {\n      return {\n        data: cache.data,\n        stale: true,\n        cachedAt: cache.fetchedAt,\n        fromCache: true,\n      };\n    }\n\n    // No cache at all — return empty with error signal\n    return { data: [], stale: true, cachedAt: null, fromCache: false };\n  }\n}\n\n/**\n * Force-refresh the catalog cache (ignores TTL).","sourceCodeStart":126,"sourceCodeEnd":162,"githubUrl":"https://github.com/diegosouzapw/OmniRoute/blob/a179ffed5bb2e0b883b9ae7214ce8717b2a94c4d/src/lib/catalog/openrouterCatalog.ts#L126-L162","documentation":"Error \"[OpenRouterCatalog] Fetch failed, using stale cache:\" thrown in diegosouzapw/OmniRoute.","triggerScenarios":"Thrown at src/lib/catalog/openrouterCatalog.ts:144 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":[],"exampleFix":null,"handlingStrategy":null,"validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"a179ffed5bb2e0b883b9ae7214ce8717b2a94c4d","analyzedAt":"2026-08-25T18:35:09.898Z","schemaVersion":2},"datasetVersion":"2026-08-25T21:54:21.419Z"}