{"record":{"id":"3538d79788afbd59","repo":"Significant-Gravitas/AutoGPT","slug":"codex-builder-session-unsupported","errorCode":null,"errorMessage":"codex_builder_session_unsupported","messagePattern":"codex_builder_session_unsupported","errorType":"http","errorClass":"HTTPException","httpStatus":422,"severity":"warning","filePath":"autogpt_platform/backend/backend/api/features/chat/routes.py","lineNumber":570,"sourceCode":"async def list_chat_transports(\n    user_id: Annotated[str, Security(auth.get_user_id)],\n) -> ChatTransportsResponse:\n    return ChatTransportsResponse(transports=await _get_chat_transports(user_id))\n\n\nasync def _resolve_new_session_llm_route(\n    user_id: str,\n    request: CreateSessionRequest | None,\n) -> tuple[CopilotLlmAuthProvider, str | None]:\n    auth_provider = request.llm_auth_provider if request else \"platform\"\n    credential_id = request.llm_credential_id if request else None\n\n    if auth_provider == \"codex\":\n        await enforce_codex_access_http(user_id)\n\n    if request is not None and request.builder_graph_id is not None:\n        if auth_provider == \"codex\" or credential_id is not None:\n            raise HTTPException(\n                status_code=422,\n                detail=\"codex_builder_session_unsupported\",\n            )\n        if not _is_deployment_chat_available():\n            raise HTTPException(\n                status_code=503,\n                detail=\"chat_transport_not_configured\",\n            )\n        return \"platform\", None\n\n    transports = await _get_chat_transports(user_id)\n    if request is not None:\n        route_was_explicit = bool(\n            {\"llm_auth_provider\", \"llm_credential_id\"} & request.model_fields_set\n        )\n        if route_was_explicit:\n            if auth_provider == \"platform\" and credential_id is not None:\n                raise HTTPException(","sourceCodeStart":552,"sourceCodeEnd":588,"githubUrl":"https://github.com/Significant-Gravitas/AutoGPT/blob/9c8bb5550f446ba5d3046b78896578742495b3cf/autogpt_platform/backend/backend/api/features/chat/routes.py#L552-L588","documentation":"A 422 from _resolve_new_session_llm_route: a new session carries a builder_graph_id (a deployment/builder chat) together with either llm_auth_provider='codex' or a non-null llm_credential_id. Builder sessions are hard-wired to the platform LLM route; custom credentials or the codex provider are simply not supported for them, so the request is rejected before any validation of the graph.","triggerScenarios":"POST /chat/sessions with {\"builder_graph_id\": \"...\", \"llm_auth_provider\": \"codex\"} or {\"builder_graph_id\": \"...\", \"llm_credential_id\": \"...\"}.","commonSituations":"Frontend session-creation form keeps a previously selected credential/provider in state and merges it into the builder-chat payload; a shared createSession() client helper always includes credential fields; API consumers assuming all session types accept routing overrides.","solutions":["Omit llm_auth_provider and llm_credential_id entirely when creating a builder/deployment session — it always routes to 'platform'.","Fix the client to build the request per session type: builder sessions send only builder_graph_id (+ dry_run), never routing fields.","If you intended a codex/custom-credential chat, drop builder_graph_id and create a normal session instead."],"exampleFix":"// before\ncreateSession({builder_graph_id: graphId, llm_credential_id: credId})\n\n// after\ncreateSession({builder_graph_id: graphId})","handlingStrategy":"validation","validationCode":"const body: CreateSession = {builder_graph_id: graphId};\n// never add llm_* fields for builder sessions\nif ('llm_credential_id' in body || 'llm_auth_provider' in body) throw new Error('invalid builder payload');","typeGuard":"function isPlainBuilderSessionRequest(b: Record<string, unknown>): boolean {\n  return typeof b.builder_graph_id === 'string'\n    && !('llm_auth_provider' in b) && !('llm_credential_id' in b);\n}","tryCatchPattern":null,"preventionTips":["Build create-session payloads per session type; never merge a generic credential form into builder requests.","Drop routing fields when switching the UI to builder/deployment chat."],"tags":["backend","chat","codex","session-creation","http-422"],"backgroundTag":null,"analyzedSha":"9c8bb5550f446ba5d3046b78896578742495b3cf","analyzedAt":"2026-08-14T17:17:21.957Z","schemaVersion":2},"datasetVersion":"2026-08-15T17:31:12.345Z"}