{"record":{"id":"02a68962c5676b0c","repo":"BerriAI/litellm","slug":"the-proxy-returned-a-non-json-response-from-start","errorCode":null,"errorMessage":"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. Response starts with: {response.text[:200]!r}","messagePattern":"The proxy returned a non-JSON response from (.+?) \\(content-type: (.+?)\\)\\. A proxy, load balancer, or auth gateway in front of LiteLLM may be intercepting the request\\. Response starts with: (.+?)","errorType":"exception","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"litellm/proxy/client/cli/commands/auth.py","lineNumber":448,"sourceCode":"\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(\n            f\"The response from {start_url} is missing required field(s): {', '.join(missing_fields)}. \"\n            \"The proxy version may not match this CLI; upgrade whichever is older.\"\n        )\n    return data\n\n\ndef _get_cli_sso_poll_headers(poll_secret: str) -> dict[str, str]:\n    return {\"x-litellm-cli-poll-secret\": poll_secret}\n","sourceCodeStart":430,"sourceCodeEnd":466,"githubUrl":"https://github.com/BerriAI/litellm/blob/77b7c6c40c0c5aa5fbcb1d6a1825ac39ca8829b8/litellm/proxy/client/cli/commands/auth.py#L430-L466","documentation":"Error \"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. Response starts with: {response.text[:200]!r}\" thrown in BerriAI/litellm.","triggerScenarios":"Thrown at litellm/proxy/client/cli/commands/auth.py:448 when the library encounters an invalid state.","commonSituations":"A middlebox returned a non-JSON response to the CLI login request.","solutions":["Check for an intercepting proxy/load balancer/auth gateway returning HTML instead of JSON.","Bypass the interceptor or fix its configuration."],"exampleFix":"curl -i $PROXY/... to inspect what the front-end proxy returns.","handlingStrategy":"try-catch","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"}