diegosouzapw/OmniRoute · error

[QuotaCache] Refresh failed for

Error message

[QuotaCache] Refresh failed for ${entry.connectionId.slice(0, 8)}:

What it means

QuotaCache background refresh failure: the scheduled per-connection quota refresh (getUsageForProvider through the connection's proxy) threw. Logged as a warning with the truncated connectionId; the stale cached quotas remain in place — this is not a request-path error.

Solutions

  1. Check the connection's credentials and proxy health
  2. The cache self-heals on the next refresh tick — no action needed for transient failures
  3. Disable quota cache refresh if the provider's usage endpoint is permanently broken
Defensive patterns

Strategy: retry

When it happens

Trigger: Thrown at src/domain/quotaCache.ts:706 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/d1e50933729bee6b. Report an issue: GitHub.

Appendix: source

Thrown at src/domain/quotaCache.ts:706

  refreshingSet.add(entry.connectionId);

  try {
    const connection = await getCachedProviderConnectionById(entry.connectionId);
    if (!connection || connection.authType !== "oauth" || !connection.isActive) {
      cache.delete(entry.connectionId);
      return;
    }

    const proxyInfo = await resolveProxyForConnection(entry.connectionId);
    const usage = await runWithProxyContext(proxyInfo?.proxy || null, () =>
      getUsageForProvider(connection)
    );

    if (usage?.quotas) {
      setQuotaCache(entry.connectionId, entry.provider, usage.quotas);
    }
  } catch (err) {
    console.warn(
      `[QuotaCache] Refresh failed for ${entry.connectionId.slice(0, 8)}:`,
      (err as any)?.message || err
    );
  } finally {
    refreshingSet.delete(entry.connectionId);
  }
}

function needsRefresh(entry: QuotaCacheEntry, now: number): boolean {
  const age = now - entry.fetchedAt;
  if (entry.exhausted) {
    if (entry.nextResetAt) {
      const resetMs = parseDate(entry.nextResetAt);
      if (resetMs !== null && resetMs <= now) return true;
    }
    return age >= EXHAUSTED_REFRESH_MS;
  }
  return age >= ACTIVE_TTL_MS;

View on GitHub (pinned to a179ffed5b)