{"record":{"id":"2d0fdde3b40a8449","repo":"diegosouzapw/OmniRoute","slug":"strict-zero-cost-usage-refresh-failed-treating-a","errorCode":null,"errorMessage":"STRICT_ZERO_COST: usage refresh failed, treating as UNKNOWN","messagePattern":"STRICT_ZERO_COST: usage refresh failed, treating as UNKNOWN","errorType":"console","errorClass":null,"httpStatus":null,"severity":"error","filePath":"open-sse/services/autoCombo/freeAccessQuota.ts","lineNumber":168,"sourceCode":"    );\n    const remaining = extractRemainingAllowance(usage);\n    const state: FreeAccessState = {\n      status: remaining === null ? \"UNKNOWN\" : remaining > 0 ? \"SAFE\" : \"EXHAUSTED\",\n      remainingFreeAllowance: remaining,\n      resetAt:\n        usage &&\n        typeof usage === \"object\" &&\n        typeof (usage as Record<string, unknown>).resetAt === \"string\"\n          ? ((usage as Record<string, unknown>).resetAt as string)\n          : null,\n      checkedAt: new Date().toISOString(),\n    };\n    cache.set(key, { state, fetchedAtMs: Date.now() });\n  } catch (err) {\n    // A failed lookup must never leave a stale SAFE entry behind — drop it so\n    // the next read is a clean cache miss (UNKNOWN), not a lucky reuse.\n    cache.delete(key);\n    log.warn(\"AUTO\", \"STRICT_ZERO_COST: usage refresh failed, treating as UNKNOWN\", {\n      provider,\n      err: err instanceof Error ? err.message : String(err),\n    });\n  } finally {\n    inFlight.delete(key);\n  }\n}\n\n/**\n * Synchronous read for `strictZeroCostFilter.ts`. Returns `undefined` when\n * there's no usage adapter for this provider at all (a permanent UNKNOWN, no\n * point ever refreshing), or on a cold/stale cache — in both cases a\n * background refresh is kicked off (fire-and-forget, subject to the\n * concurrency cap above) so a *later* read can benefit, but this call itself\n * never blocks or throws.\n */\nexport function resolveFreeAccessState(\n  provider: string,","sourceCodeStart":150,"sourceCodeEnd":186,"githubUrl":"https://github.com/diegosouzapw/OmniRoute/blob/a179ffed5bb2e0b883b9ae7214ce8717b2a94c4d/open-sse/services/autoCombo/freeAccessQuota.ts#L150-L186","documentation":"Error \"STRICT_ZERO_COST: usage refresh failed, treating as UNKNOWN\" thrown in diegosouzapw/OmniRoute.","triggerScenarios":"Thrown at open-sse/services/autoCombo/freeAccessQuota.ts:168 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"}