{"record":{"id":"59220f15b130804c","repo":"BerriAI/litellm","slug":"starting-cli-login-failed-http-response-status-c","errorCode":null,"errorMessage":"Starting CLI login failed: HTTP {response.status_code} from {start_url}","messagePattern":"Starting CLI login failed: HTTP (.+?) from (.+?)","errorType":"exception","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"litellm/proxy/client/cli/commands/auth.py","lineNumber":439,"sourceCode":"def _start_cli_sso_flow(base_url: str) -> CliSsoStartData:\n    start_url: Final = f\"{base_url}/sso/cli/start\"\n    try:\n        response: Final = requests.post(start_url, timeout=10)\n    except requests.RequestException as e:\n        raise ValueError(\n            f\"Could not reach the proxy at {start_url}: {e}. \"\n            \"Check that the proxy is running and that --base-url points at it.\"\n        ) from e\n\n    if response.status_code in (404, 405):\n        raise ValueError(\n            f\"POST {start_url} returned HTTP {response.status_code}. \"\n            \"Either --base-url is wrong, or the proxy is older than this CLI and does not support \"\n            \"the CLI SSO login flow; upgrade the proxy or use a CLI version that matches it.\"\n        )\n    if response.status_code != 200:\n        detail: Final = _response_error_detail(response)\n        raise ValueError(\n            f\"Starting CLI login failed: HTTP {response.status_code} from {start_url}\"\n            + (f\": {detail}\" if detail else \"\")\n        )\n\n    try:\n        data: Final[CliSsoStartData] = response.json()\n    except ValueError:\n        content_type: Final = response.headers.get(\"content-type\", \"unknown\")\n        raise ValueError(\n            f\"The proxy returned a non-JSON response from {start_url} (content-type: {content_type}). \"\n            \"A proxy, load balancer, or auth gateway in front of LiteLLM may be intercepting the request. \"\n            f\"Response starts with: {response.text[:200]!r}\"\n        )\n\n    required_fields: Final[tuple[str, ...]] = (\"login_id\", \"poll_secret\", \"user_code\")\n    missing_fields: Final = tuple(field for field in required_fields if not isinstance(data.get(field), str))\n    if missing_fields:\n        raise ValueError(","sourceCodeStart":421,"sourceCodeEnd":457,"githubUrl":"https://github.com/BerriAI/litellm/blob/77b7c6c40c0c5aa5fbcb1d6a1825ac39ca8829b8/litellm/proxy/client/cli/commands/auth.py#L421-L457","documentation":"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.","triggerScenarios":"Thrown at litellm/proxy/client/cli/commands/auth.py:439 when the library encounters an invalid state.","commonSituations":"The CLI login start request failed with an HTTP error.","solutions":["Check the HTTP status and proxy logs for the cause.","Verify --base-url and proxy version compatibility."],"exampleFix":"Retry with the correct --base-url after confirming the proxy is up.","handlingStrategy":"validation","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"77b7c6c40c0c5aa5fbcb1d6a1825ac39ca8829b8","analyzedAt":"2026-08-18T11:44:31.656Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-14T00:17:10.932Z"}