BerriAI/litellm · error · ValueError

Starting CLI login failed: HTTP {response.status_code} from

Error message

Starting CLI login failed: HTTP {response.status_code} from {start_url}

What it means

Raised in the CLI SSO flow when POST {base_url}/sso/cli/start does respond but with a non-2xx status (the 404/405 'wrong URL or old proxy' case has its own message). The status code and URL are embedded; typical causes are an auth gateway intercepting the request or a proxy error — the response detail is appended when present.

Source

Thrown at litellm/proxy/client/cli/commands/auth.py:439

def _start_cli_sso_flow(base_url: str) -> CliSsoStartData:
    start_url: Final = f"{base_url}/sso/cli/start"
    try:
        response: Final = requests.post(start_url, timeout=10)
    except requests.RequestException as e:
        raise ValueError(
            f"Could not reach the proxy at {start_url}: {e}. "
            "Check that the proxy is running and that --base-url points at it."
        ) from e

    if response.status_code in (404, 405):
        raise ValueError(
            f"POST {start_url} returned HTTP {response.status_code}. "
            "Either --base-url is wrong, or the proxy is older than this CLI and does not support "
            "the CLI SSO login flow; upgrade the proxy or use a CLI version that matches it."
        )
    if response.status_code != 200:
        detail: Final = _response_error_detail(response)
        raise ValueError(
            f"Starting CLI login failed: HTTP {response.status_code} from {start_url}"
            + (f": {detail}" if detail else "")
        )

    try:
        data: Final[CliSsoStartData] = response.json()
    except ValueError:
        content_type: Final = response.headers.get("content-type", "unknown")
        raise ValueError(
            f"The proxy returned a non-JSON response from {start_url} (content-type: {content_type}). "
            "A proxy, load balancer, or auth gateway in front of LiteLLM may be intercepting the request. "
            f"Response starts with: {response.text[:200]!r}"
        )

    required_fields: Final[tuple[str, ...]] = ("login_id", "poll_secret", "user_code")
    missing_fields: Final = tuple(field for field in required_fields if not isinstance(data.get(field), str))
    if missing_fields:
        raise ValueError(

View on GitHub (pinned to 77b7c6c40c)

Solutions

  1. Check the HTTP status and proxy logs for the cause.
  2. Verify --base-url and proxy version compatibility.

Example fix

Retry with the correct --base-url after confirming the proxy is up.
Defensive patterns

Strategy: validation

When it happens

Trigger: Thrown at litellm/proxy/client/cli/commands/auth.py:439 when the library encounters an invalid state.

Common situations: The CLI login start request failed with an HTTP error.


AI-assisted analysis of BerriAI/litellm@77b7c6c40c (2026-08-18). Data as JSON: /api/errors/59220f15b130804c. Report an issue: GitHub.