odysseus-dev/odysseus · error · HTTPException

Selected model endpoint is not configured

Error message

Selected model endpoint is not configured

What it means

The session has a model selected but no endpoint_url configured, so the system has nowhere to send the request. This is checked after model validation on the non-streaming path; both must be present for a send to proceed.

Source

Thrown at routes/chat_routes.py:712

        try:
            sess = session_manager.get_session(session)
        except KeyError:
            raise HTTPException(404, f"Session '{session}' not found")
        owner = effective_user(request)
        if _clear_orphaned_session_endpoint(sess, owner=owner):
            raise HTTPException(400, "Selected model endpoint was removed. Pick another model in Settings.")

        # Empty model + live endpoint = setup race (Issue #587). Repair from
        # the endpoint's cached model list before privilege checks, which
        # otherwise see "" and behave inconsistently with the allowlist.
        _recover_empty_session_model(sess, session, owner=owner)
        if not getattr(sess, "model", "").strip():
            raise HTTPException(
                400,
                "No model selected for this chat. Open the model picker and choose one before sending.",
            )
        if not (getattr(sess, "endpoint_url", "") or "").strip():
            raise HTTPException(400, "Selected model endpoint is not configured")

        # Same allowed_models + daily-cap gate as chat_stream (mirror so the
        # non-streaming path can't be used to bypass).
        _enforce_chat_privileges(request, sess)

        tool_policy = build_effective_tool_policy(last_user_message=message)
        allow_tool_preprocessing = not tool_policy.block_all_tool_calls

        # Inline memory command
        memory_response = None
        if not tool_policy.blocks("manage_memory"):
            memory_response = await chat_handler.handle_memory_command(sess, message)
        if memory_response:
            return {"response": memory_response}

        foreground_policy = resolve_foreground_model_policy(
            owner=owner,
            allowed_models=_allowed_models_for_request(request),

View on GitHub (pinned to f9235ebbf1)

Solutions

  1. Re-select the model/endpoint in the chat so the session gets a full endpoint_url
  2. Fix the endpoint record in Settings to include its base URL
  3. If creating sessions programmatically, always set both model and endpoint_url
Defensive patterns

Strategy: validation

Validate before calling

if (!session.endpoint_url || !session.endpoint_url.trim()) { promptEndpointRebind(); return; }

Type guard

function hasEndpointUrl(s: {endpoint_url?: string | null}): boolean {
  return typeof s.endpoint_url === 'string' && s.endpoint_url.trim().length > 0;
}

Prevention

When it happens

Trigger: Session row has model set but endpoint_url empty — typically a partially initialized session, a manual DB edit, or an endpoint record missing its URL field.

Common situations: Endpoint saved without a base URL; session created by a script that set model but not endpoint_url; endpoint record corrupted during migration.

Related errors


AI-assisted analysis of odysseus-dev/odysseus@f9235ebbf1 (2026-08-14). Data as JSON: /api/errors/fbe453a008a9e540. Report an issue: GitHub.