{"record":{"id":"a86c02a499b23045","repo":"Significant-Gravitas/AutoGPT","slug":"codex-credential-not-found","errorCode":null,"errorMessage":"codex_credential_not_found","messagePattern":"codex_credential_not_found","errorType":"http","errorClass":"HTTPException","httpStatus":404,"severity":"error","filePath":"autogpt_platform/backend/backend/api/features/chat/routes.py","lineNumber":609,"sourceCode":"                )\n            if auth_provider == \"codex\" and credential_id is None:\n                raise HTTPException(\n                    status_code=422,\n                    detail=\"codex_credential_required\",\n                )\n            selected_route = next(\n                (\n                    transport\n                    for transport in transports\n                    if transport.auth_provider == auth_provider\n                    and transport.credential_id == credential_id\n                    and transport.available\n                ),\n                None,\n            )\n            if selected_route is None:\n                if auth_provider == \"codex\":\n                    raise HTTPException(\n                        status_code=404,\n                        detail=\"codex_credential_not_found\",\n                    )\n                raise HTTPException(\n                    status_code=503,\n                    detail=\"chat_transport_not_configured\",\n                )\n            return auth_provider, credential_id\n\n    default_route = next(\n        (transport for transport in transports if transport.default),\n        None,\n    )\n    if default_route is not None:\n        return default_route.auth_provider, default_route.credential_id\n    if any(transport.available for transport in transports):\n        raise HTTPException(\n            status_code=409,","sourceCodeStart":591,"sourceCodeEnd":627,"githubUrl":"https://github.com/Significant-Gravitas/AutoGPT/blob/9c8bb5550f446ba5d3046b78896578742495b3cf/autogpt_platform/backend/backend/api/features/chat/routes.py#L591-L627","documentation":"A 404 from _resolve_new_session_llm_route: the client explicitly requested the codex route with a specific credential, but no available transport in _get_chat_transports(user_id) matches that exact (auth_provider='codex', credential_id) pair with available=true. The credential was either deleted, belongs to another user, or its transport is currently unavailable.","triggerScenarios":"POST /chat/sessions with {\"llm_auth_provider\": \"codex\", \"llm_credential_id\": X} where credential X is missing, not owned by this user, revoked, or its transport reports available=false.","commonSituations":"Credential deleted or re-keyed after the client cached its id (stale dropdown); credential list fetched from a different environment; codex backend config missing/unhealthy so the transport is marked unavailable; user session restored from localStorage with an old credential id.","solutions":["Refetch the user's credential/transports list and retry with a currently available codex credential id.","If the credential was deleted, have the user re-add it, then select the new id.","If the credential exists but is unavailable, check the codex transport configuration/health on the backend (env vars, connectivity) — availability=false for all credentials points at backend config."],"exampleFix":"// before\ncreateSession({llm_auth_provider: 'codex', llm_credential_id: cachedCredId})  // stale id\n\n// after\nconst creds = await listChatTransports(userId);\nconst cred = creds.find(t => t.auth_provider === 'codex' && t.available);\nif (cred) createSession({llm_auth_provider: 'codex', llm_credential_id: cred.credential_id});","handlingStrategy":"validation","validationCode":"const transports = await listChatTransports(userId);\nconst match = transports.find(t => t.auth_provider === 'codex' && t.credential_id === credId && t.available);\nif (!match) { refreshCredentialPicker(); return; }\nawait createSession({llm_auth_provider: 'codex', llm_credential_id: credId});","typeGuard":"function isAvailableCredential(transports: Transport[], credId: string): boolean {\n  return transports.some(t => t.auth_provider === 'codex' && t.credential_id === credId && t.available);\n}","tryCatchPattern":"try {\n  await createSession({llm_auth_provider: 'codex', llm_credential_id: credId});\n} catch (e) {\n  if (e.status === 404) { await refetchCredentials(); promptReselect(); return; }\n  throw e;\n}","preventionTips":["Refetch transports before creating a codex session; never trust cached credential ids.","Drop deleted credential ids from client storage immediately.","If all codex transports show unavailable, suspect backend codex config, not the credential."],"tags":["backend","chat","codex","credentials","http-404"],"backgroundTag":null,"analyzedSha":"9c8bb5550f446ba5d3046b78896578742495b3cf","analyzedAt":"2026-08-14T17:17:21.957Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}