diegosouzapw/OmniRoute · error · CodexResetCreditError
codex_reset_credit_list_failed
codex_reset_credit_list_failed
Error message
Failed to load Codex reset credits.
What it means
Catch-all wrap in listCodexResetCredits: a non-CodexResetCreditError exception escaped the listing flow (fetch failure, JSON parse error, unexpected DB error). It is re-wrapped with sanitized message fallback 'Failed to load Codex reset credits.' so raw internals never leak; the original cause is only in server logs.
Solutions
- Retry — transient network/parse failures are the usual cause
- Inspect server logs for the underlying exception if it persists
- Verify the Codex backend is reachable from the host
Defensive patterns
Strategy: retry
When it happens
Trigger: Thrown at src/lib/usage/codexResetCredits.ts:462 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/a6c53d08a0031136.
Report an issue: GitHub.
Appendix: source
Thrown at src/lib/usage/codexResetCredits.ts:462
const payload = await readResponsePayload(response);
if (!response.ok) {
throwKnownConsumeError(payload);
throw new CodexResetCreditError(
response.status,
"codex_reset_credit_upstream_error",
`Codex reset-credit API returned HTTP ${response.status}.`
);
}
const result = parseAvailableResetCredits(payload);
return {
availableCount: result.availableCount,
credits: result.credits.map(toPublicResetCredit),
};
} catch (error) {
if (error instanceof CodexResetCreditError) throw error;
throw new CodexResetCreditError(
500,
"codex_reset_credit_list_failed",
sanitizeErrorMessage(error) || "Failed to load Codex reset credits."
);
}
}
export async function consumeCodexResetCredit(
connectionId: string,
idempotencyKey: string,
creditId?: string
): Promise<{
outcome: CodexResetCreditOutcome;
usage: JsonRecord;
}> {
if (!connectionId || typeof connectionId !== "string") {
throw new CodexResetCreditError(400, "connection_id_required", "connectionId is required.");
}View on GitHub (pinned to a179ffed5b)