{"record":{"id":"fa0855d8265b91c4","repo":"diegosouzapw/OmniRoute","slug":"codex-provider-required","errorCode":"codex_provider_required","errorMessage":"Reset credits can only be redeemed for OpenAI Codex accounts.","messagePattern":"Reset credits can only be redeemed for OpenAI Codex accounts\\.","errorType":"exception","errorClass":"CodexResetCreditError","httpStatus":400,"severity":"error","filePath":"src/lib/usage/codexResetCredits.ts","lineNumber":323,"sourceCode":"\nasync function loadCodexConnection(connectionId: string): Promise<CodexConnectionLike> {\n  if (await isConnectionUnavailableToAuxiliaryActivity(connectionId)) {\n    throw new CodexResetCreditError(\n      409,\n      \"exclusive_lease_active\",\n      \"Reset-credit operations are deferred while an exclusive lease is active.\"\n    );\n  }\n  const connection = (await getProviderConnectionById(\n    connectionId\n  )) as unknown as CodexConnectionLike | null;\n\n  if (!connection) {\n    throw new CodexResetCreditError(404, \"connection_not_found\", \"Connection not found.\");\n  }\n\n  if (connection.provider !== \"codex\") {\n    throw new CodexResetCreditError(\n      400,\n      \"codex_provider_required\",\n      \"Reset credits can only be redeemed for OpenAI Codex accounts.\"\n    );\n  }\n\n  if (connection.authType !== \"oauth\") {\n    throw new CodexResetCreditError(\n      400,\n      \"codex_oauth_required\",\n      \"Codex reset credits require an OAuth connection.\"\n    );\n  }\n\n  return connection;\n}\n\nasync function refreshCodexConnectionIfNeeded(","sourceCodeStart":305,"sourceCodeEnd":341,"githubUrl":"https://github.com/diegosouzapw/OmniRoute/blob/a179ffed5bb2e0b883b9ae7214ce8717b2a94c4d/src/lib/usage/codexResetCredits.ts#L305-L341","documentation":"Provider gate in loadCodexConnection: the connection exists but its provider is not \"codex\". Reset credits are a Codex-only mechanism; calling the reset-credit flow with any other provider's connection id is rejected with 400 codex_provider_required.","triggerScenarios":"Thrown at src/lib/usage/codexResetCredits.ts:323 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Pass the connection id of the OpenAI Codex connection","Use the provider-specific flow matching the connection you hold"],"exampleFix":null,"handlingStrategy":"validation","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"a179ffed5bb2e0b883b9ae7214ce8717b2a94c4d","analyzedAt":"2026-08-25T18:35:09.898Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}