{"record":{"id":"27d6e5d1948fbe8e","repo":"BerriAI/litellm","slug":"masked-response-body","errorCode":null,"errorMessage":"{masked_response_body}","messagePattern":"\\{masked_response_body\\}","errorType":"http","errorClass":"MaskedHTTPStatusError","httpStatus":null,"severity":"error","filePath":"litellm/llms/custom_httpx/http_handler.py","lineNumber":460,"sourceCode":"            except Exception:\n                response.close()\n                return b\"\"\n        return response.read()\n    except Exception:\n        return b\"\"\n\n\ndef _raise_masked_sync_error(e: httpx.HTTPStatusError, stream: bool) -> None:\n    \"\"\"Raise a MaskedHTTPStatusError for sync HTTP handlers.\"\"\"\n    if stream:\n        try:\n            _body: Final = mask_sensitive_info(\n                _safe_read_response(\n                    e.response,\n                    timeout=_STREAMING_ERROR_BODY_READ_TIMEOUT_SECONDS,\n                )\n            )\n            raise MaskedHTTPStatusError(e, message=_body, text=_body) from None\n        finally:\n            try:\n                e.response.close()\n            except Exception:\n                pass\n    _text: Final = mask_sensitive_info(_safe_get_response_text(e.response))\n    raise MaskedHTTPStatusError(e, message=_text, text=_text) from None\n\n\nasync def _raise_masked_async_error(e: httpx.HTTPStatusError, stream: bool) -> None:\n    \"\"\"Raise a MaskedHTTPStatusError for async HTTP handlers.\"\"\"\n    if stream:\n        try:\n            _body: Final = mask_sensitive_info(\n                await _safe_aread_response(\n                    e.response,\n                    timeout=_STREAMING_ERROR_BODY_READ_TIMEOUT_SECONDS,\n                )","sourceCodeStart":442,"sourceCodeEnd":478,"githubUrl":"https://github.com/BerriAI/litellm/blob/77b7c6c40c0c5aa5fbcb1d6a1825ac39ca8829b8/litellm/llms/custom_httpx/http_handler.py#L442-L478","documentation":"Masked error for sync streaming HTTP handlers: an httpx.HTTPStatusError was raised on a stream, and the handler re-raises it as MaskedHTTPStatusError with the response body redacted by mask_sensitive_info, so the message is the sanitized body rather than the raw one.","triggerScenarios":"Thrown at litellm/llms/custom_httpx/http_handler.py:460 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Read the masked response body in the error; the upstream HTTP call returned a non-success status.","Check the target URL, credentials, and request payload against the upstream service's API."],"exampleFix":null,"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"}