{"record":{"id":"47e815cf979d7073","repo":"diegosouzapw/OmniRoute","slug":"only-oauth-codex-connections-support-auth-json-exp","errorCode":null,"errorMessage":"Only OAuth Codex connections support auth.json export","messagePattern":"Only OAuth Codex connections support auth\\.json export","errorType":"exception","errorClass":"CodexAuthFileError","httpStatus":null,"severity":"error","filePath":"src/lib/oauth/utils/codexAuthFile.ts","lineNumber":210,"sourceCode":"      refresh_token: refreshToken,\n      account_id: accountId,\n    },\n    last_refresh: new Date().toISOString(),\n  };\n}\n\nasync function resolveFreshCodexConnection(connectionId: string): Promise<CodexConnectionLike> {\n  const connection = (await getCachedProviderConnectionById(connectionId)) as CodexConnectionLike | null;\n  if (!connection) {\n    throw new CodexAuthFileError(\"Connection not found\", 404, \"not_found\");\n  }\n\n  if (connection.provider !== \"codex\") {\n    throw new CodexAuthFileError(\"Only Codex provider connections can export Codex auth files\");\n  }\n\n  if (connection.authType !== \"oauth\") {\n    throw new CodexAuthFileError(\"Only OAuth Codex connections support auth.json export\");\n  }\n\n  if (!shouldRefreshCodexConnection(connection)) {\n    return connection;\n  }\n\n  const refreshToken = toNonEmptyString(connection.refreshToken);\n  if (!refreshToken) {\n    throw new CodexAuthFileError(\n      \"Codex connection requires refresh but no refresh_token is available. Re-authenticate first.\",\n      409,\n      \"reauth_required\"\n    );\n  }\n\n  // Pass onPersist so the DB write is atomic with the network call inside the mutex.\n  let persistedRefresh: any = null;\n  const refreshed = await getAccessToken(","sourceCodeStart":192,"sourceCodeEnd":228,"githubUrl":"https://github.com/diegosouzapw/OmniRoute/blob/a179ffed5bb2e0b883b9ae7214ce8717b2a94c4d/src/lib/oauth/utils/codexAuthFile.ts#L192-L228","documentation":"Error \"Only OAuth Codex connections support auth.json export\" thrown in diegosouzapw/OmniRoute.","triggerScenarios":"Thrown at src/lib/oauth/utils/codexAuthFile.ts:210 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"}