{"record":{"id":"329c0143de33bbb4","repo":"diegosouzapw/OmniRoute","slug":"not-found-329c01","errorCode":"not_found","errorMessage":"Connection not found","messagePattern":"Connection not found","errorType":"exception","errorClass":"CodexAuthFileError","httpStatus":404,"severity":"error","filePath":"src/lib/oauth/utils/codexAuthFile.ts","lineNumber":202,"sourceCode":"  }\n\n  return {\n    auth_mode: \"chatgpt\",\n    OPENAI_API_KEY: null,\n    tokens: {\n      id_token: idToken,\n      access_token: accessToken,\n      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.\",","sourceCodeStart":184,"sourceCodeEnd":220,"githubUrl":"https://github.com/diegosouzapw/OmniRoute/blob/a179ffed5bb2e0b883b9ae7214ce8717b2a94c4d/src/lib/oauth/utils/codexAuthFile.ts#L184-L220","documentation":"Error \"Connection not found\" thrown in diegosouzapw/OmniRoute.","triggerScenarios":"Thrown at src/lib/oauth/utils/codexAuthFile.ts:202 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"}