Significant-Gravitas/AutoGPT · warning · HTTPException

codex_credential_required

Error message

codex_credential_required

What it means

A 422 from _resolve_new_session_llm_route: the client explicitly requested the codex route (llm_auth_provider='codex') but did not supply llm_credential_id. Codex sessions are authenticated per-user via a specific stored credential, so the provider alone is under-specified and the request is rejected.

Source

Thrown at autogpt_platform/backend/backend/api/features/chat/routes.py:593

            raise HTTPException(
                status_code=503,
                detail="chat_transport_not_configured",
            )
        return "platform", None

    transports = await _get_chat_transports(user_id)
    if request is not None:
        route_was_explicit = bool(
            {"llm_auth_provider", "llm_credential_id"} & request.model_fields_set
        )
        if route_was_explicit:
            if auth_provider == "platform" and credential_id is not None:
                raise HTTPException(
                    status_code=422,
                    detail="codex_credential_not_allowed",
                )
            if auth_provider == "codex" and credential_id is None:
                raise HTTPException(
                    status_code=422,
                    detail="codex_credential_required",
                )
            selected_route = next(
                (
                    transport
                    for transport in transports
                    if transport.auth_provider == auth_provider
                    and transport.credential_id == credential_id
                    and transport.available
                ),
                None,
            )
            if selected_route is None:
                if auth_provider == "codex":
                    raise HTTPException(
                        status_code=404,
                        detail="codex_credential_not_found",

View on GitHub (pinned to 9c8bb5550f)

Solutions

  1. Include the codex credential id in the request: {"llm_auth_provider": "codex", "llm_credential_id": "<id>"}.
  2. Make the credential selector required in the client when provider is 'codex'.
  3. If the user has no codex credential, have them add one first (or fall back to the platform route by omitting both fields).

Example fix

// before
createSession({llm_auth_provider: 'codex'})

// after
createSession({llm_auth_provider: 'codex', llm_credential_id: selectedCredentialId})
Defensive patterns

Strategy: validation

Validate before calling

if (provider === 'codex' && !credentialId) {
  showPicker('Select a codex credential first');
  return;
}
await createSession({llm_auth_provider: provider, ...(provider === 'codex' && credentialId ? {llm_credential_id: credentialId} : {})});

Type guard

function isCompleteCodexRoute(provider: string, credId?: string | null): boolean {
  return provider !== 'codex' || typeof credId === 'string' && credId.length > 0;
}

Prevention

When it happens

Trigger: POST /chat/sessions with {"llm_auth_provider": "codex"} and no llm_credential_id, where at least one of the two routing fields was explicitly set (which it was — the provider).

Common situations: Client sends the provider from a dropdown but the credential selector is optional/empty; user has credentials listed but the form failed to attach the selected one; partial JSON serialization dropping the credential key.

Related errors


AI-assisted analysis of Significant-Gravitas/AutoGPT@9c8bb5550f (2026-08-14). Data as JSON: /api/errors/581fe1b3ea80936f. Report an issue: GitHub.