diegosouzapw/OmniRoute · error · CodexResetCreditError
codex_oauth_required
codex_oauth_required
Error message
Codex reset credits require an OAuth connection.
What it means
Auth-type gate in loadCodexConnection: the connection's authType is not "oauth" (e.g. an API-key based connection). Reset credits ride on the ChatGPT/Codex OAuth account identity, so an API-key connection cannot redeem them; rejected with 400 codex_oauth_required.
Solutions
- Connect the Codex account via OAuth instead of an API key
- Use an OAuth-connected Codex connection id for reset-credit operations
Defensive patterns
Strategy: fallback
When it happens
Trigger: Thrown at src/lib/usage/codexResetCredits.ts:331 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/f94ae99569d93865.
Report an issue: GitHub.
Appendix: source
Thrown at src/lib/usage/codexResetCredits.ts:331
}
const connection = (await getProviderConnectionById(
connectionId
)) as unknown as CodexConnectionLike | null;
if (!connection) {
throw new CodexResetCreditError(404, "connection_not_found", "Connection not found.");
}
if (connection.provider !== "codex") {
throw new CodexResetCreditError(
400,
"codex_provider_required",
"Reset credits can only be redeemed for OpenAI Codex accounts."
);
}
if (connection.authType !== "oauth") {
throw new CodexResetCreditError(
400,
"codex_oauth_required",
"Codex reset credits require an OAuth connection."
);
}
return connection;
}
async function refreshCodexConnectionIfNeeded(
connection: CodexConnectionLike,
force = false
): Promise<CodexConnectionLike> {
const refreshed = await refreshAndUpdateCredentials(connection, {
allowRotatingRefresh: true,
force,
});
return refreshed.connection as CodexConnectionLike;View on GitHub (pinned to a179ffed5b)