diegosouzapw/OmniRoute · error

[OpenRouterCatalog] Fetch failed, using stale cache:

Error message

[OpenRouterCatalog] Fetch failed, using stale cache:

What it means

Error "[OpenRouterCatalog] Fetch failed, using stale cache:" thrown in diegosouzapw/OmniRoute.

Source

Thrown at src/lib/catalog/openrouterCatalog.ts:144

  if (cache && cache.fetchedAt) {
    const age = now - new Date(cache.fetchedAt).getTime();
    if (age < ttl) {
      return {
        data: cache.data,
        stale: false,
        cachedAt: cache.fetchedAt,
        fromCache: true,
      };
    }
  }

  // Cache expired or missing — attempt fresh fetch
  try {
    const data = await fetchFromAPI();
    writeCache(data);
    return { data, stale: false, cachedAt: null, fromCache: false };
  } catch (err) {
    console.warn("[OpenRouterCatalog] Fetch failed, using stale cache:", err);

    // Stale-if-error: return old cache if available
    if (cache) {
      return {
        data: cache.data,
        stale: true,
        cachedAt: cache.fetchedAt,
        fromCache: true,
      };
    }

    // No cache at all — return empty with error signal
    return { data: [], stale: true, cachedAt: null, fromCache: false };
  }
}

/**
 * Force-refresh the catalog cache (ignores TTL).

View on GitHub (pinned to a179ffed5b)

When it happens

Trigger: Thrown at src/lib/catalog/openrouterCatalog.ts:144 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/013fd2f22d1a3425. Report an issue: GitHub.