Significant-Gravitas/AutoGPT · warning · HTTPException
builder_graph_id and expert_id are mutually exclusive
Error message
builder_graph_id and expert_id are mutually exclusive
What it means
A 422 from create_session: the request passed both builder_graph_id and expert_id. These scoping options are mutually exclusive because the builder branch ignores expert_id entirely — accepting both would validate an expert and then silently drop the scoping, so the route rejects the combination upfront.
Source
Thrown at autogpt_platform/backend/backend/api/features/chat/routes.py:672
the bound graph) and a small blacklist hides tools that conflict
with the panel's scope (see :data:`BUILDER_BLOCKED_TOOLS`).
Args:
user_id: The authenticated user ID parsed from the JWT (required).
request: Optional request body with ``dry_run``,
``builder_graph_id`` and/or ``expert_id``.
Returns:
CreateSessionResponse: Details of the resulting session.
"""
dry_run = request.dry_run if request else False
builder_graph_id = request.builder_graph_id if request else None
expert_id = request.expert_id if request else None
# The builder branch below ignores expert_id, so accepting both would
# validate the expert and then silently drop the scoping. Reject upfront.
if builder_graph_id and expert_id:
raise HTTPException(
status_code=422,
detail="builder_graph_id and expert_id are mutually exclusive",
)
if expert_id is not None:
expert = await experts_db.get_expert(user_id, expert_id)
if expert is None or expert.is_archived:
raise HTTPException(status_code=404, detail="Expert not found")
llm_auth_provider, llm_credential_id = await _resolve_new_session_llm_route(
user_id, request
)
if llm_auth_provider == "platform":
await enforce_payment_paywall(user_id)
logger.info(
f"Creating session with user_id: "View on GitHub (pinned to 9c8bb5550f)
Solutions
- Send exactly one scoping field: builder_graph_id for a builder/deployment chat, or expert_id for an expert chat — never both.
- Fix the client to reset expert_id when a builder graph is selected (and vice versa).
- If merging partial payloads client-side, make the two ids mutually exclusive keys in the request builder.
Example fix
// before
createSession({builder_graph_id: g, expert_id: e})
// after
createSession({builder_graph_id: g, expert_id: undefined}) Defensive patterns
Strategy: validation
Validate before calling
if (builderGraphId && expertId) throw new Error('pick one: builder_graph_id or expert_id');
await createSession(builderGraphId ? {builder_graph_id: builderGraphId} : {expert_id: expertId}); Type guard
function isExclusiveScoping(b?: string, e?: string): boolean {
return !(b && e);
} Prevention
- Clear expert_id when a builder graph is selected and vice versa.
- Build payloads per chat type instead of merging shared state.
When it happens
Trigger: POST /chat/sessions with a body containing both builder_graph_id and expert_id (both truthy strings).
Common situations: Client state leaking: user opened a builder-agent chat but an expert id from a previous selection stays in the shared form; a generic createSession(payload) helper merges stale fields; API consumers assuming ids can be combined for tighter scoping.
Related errors
- Title must not be blank
- codex_builder_session_unsupported
- codex_credential_not_allowed
- codex_credential_required
- Page must be greater than 0
AI-assisted analysis of Significant-Gravitas/AutoGPT@9c8bb5550f (2026-08-14).
Data as JSON: /api/errors/e28c7c4a64d91aa6.
Report an issue: GitHub.