diegosouzapw/OmniRoute · error · CodexResetCreditError

codex_reset_credit_failed

codex_reset_credit_failed

Error message

Failed to redeem Codex reset credit.

What it means

Catch-all wrap in consumeCodexResetCredit: an unexpected (non-CodexResetCreditError) exception escaped the redeem flow — network failure during consume, token refresh error, or limits-refresh failure after a successful redemption. The sanitized fallback message keeps internals out of the response; details live in logs.

Solutions

  1. Check logs to see whether the redeem itself succeeded before the failure (idempotency makes retry safe)
  2. Retry with the same idempotencyKey
  3. Verify network access to the Codex backend if persistent
Defensive patterns

Strategy: retry

When it happens

Trigger: Thrown at src/lib/usage/codexResetCredits.ts:515 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/e38f18bb01de683e. Report an issue: GitHub.

Appendix: source

Thrown at src/lib/usage/codexResetCredits.ts:515

      throwKnownConsumeError(payload);
      throw new CodexResetCreditError(
        response.status,
        "codex_reset_credit_upstream_error",
        `Codex reset-credit API returned HTTP ${response.status}.`
      );
    }

    const outcome = parseConsumeOutcome(payload);
    invalidateCodexQuotaCache(connectionId);

    const refreshed = await fetchAndPersistProviderLimits(connectionId, "manual", {
      allowRotatingRefresh: true,
    });

    return { outcome, usage: refreshed.usage };
  } catch (error) {
    if (error instanceof CodexResetCreditError) throw error;
    throw new CodexResetCreditError(
      500,
      "codex_reset_credit_failed",
      sanitizeErrorMessage(error) || "Failed to redeem Codex reset credit."
    );
  }
}

View on GitHub (pinned to a179ffed5b)