Significant-Gravitas/AutoGPT · warning · HTTPException

chat_transport_selection_required

Error message

chat_transport_selection_required

What it means

A 409 (conflict) from _resolve_new_session_llm_route's default-route fallback: the user specified no explicit routing fields, there is no default transport, but at least one transport is available. The backend refuses to silently pick among the user's multiple eligible routes, so it asks the client to disambiguate by explicitly selecting one.

Source

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

                if auth_provider == "codex":
                    raise HTTPException(
                        status_code=404,
                        detail="codex_credential_not_found",
                    )
                raise HTTPException(
                    status_code=503,
                    detail="chat_transport_not_configured",
                )
            return auth_provider, credential_id

    default_route = next(
        (transport for transport in transports if transport.default),
        None,
    )
    if default_route is not None:
        return default_route.auth_provider, default_route.credential_id
    if any(transport.available for transport in transports):
        raise HTTPException(
            status_code=409,
            detail="chat_transport_selection_required",
        )
    raise HTTPException(
        status_code=503,
        detail="chat_transport_not_configured",
    )


@router.post("/sessions")
async def create_session(
    user_id: Annotated[str, Security(auth.get_user_id)],
    ctx: Annotated[auth.RequestContext, Security(auth.get_request_context)],
    request: CreateSessionRequest | None = None,
) -> CreateSessionResponse:
    """Create (or get-or-create) a chat session.

    Two modes, selected by the request body:

View on GitHub (pinned to 9c8bb5550f)

Solutions

  1. Explicitly pass the route in the create request: {"llm_auth_provider": "codex", "llm_credential_id": X} or {"llm_auth_provider": "platform"}.
  2. Better UX: on 409, prompt the user to pick a route (or set a default credential in settings), then retry with the selection.
  3. To stop it recurring, have the user set one credential as default so the fallback path resolves.

Example fix

// before
createSession({})  // 409: multiple available routes, none default

// after
const choice = await promptUserToSelectRoute();
createSession(choice);  // e.g. {llm_auth_provider: 'codex', llm_credential_id: '...'}
Defensive patterns

Strategy: fallback

Validate before calling

const transports = await listChatTransports(userId);
const hasDefault = transports.some(t => t.default);
if (!hasDefault && transports.some(t => t.available)) {
  const choice = await promptRouteSelection(transports.filter(t => t.available));
  await createSession(choice);
}

Type guard

function needsExplicitRoute(transports: Transport[]): boolean {
  return !transports.some(t => t.default) && transports.some(t => t.available);
}

Try / catch

try {
  await createSession({});
} catch (e) {
  if (e.status === 409 && e.detail === 'chat_transport_selection_required') {
    const choice = await promptRouteSelection();
    await createSession(choice); // fallback: retry with explicit route
    return;
  }
  throw e;
}

Prevention

When it happens

Trigger: POST /chat/sessions with no llm_auth_provider/llm_credential_id when the user's transport list has available transports but none flagged default=true (e.g. user has several codex credentials and no default set, or a platform + codex mix with the default cleared).

Common situations: User added a second LLM credential without marking a default; a 'default' flag was unset by a credential deletion or settings change; first session creation after connecting multiple providers.

Related errors


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