{"record":{"id":"fbf74d9a26bc90dc","repo":"BerriAI/litellm","slug":"masked-response-text","errorCode":null,"errorMessage":"{masked_response_text}","messagePattern":"\\{masked_response_text\\}","errorType":"http","errorClass":"MaskedHTTPStatusError","httpStatus":null,"severity":"error","filePath":"litellm/llms/custom_httpx/http_handler.py","lineNumber":467,"sourceCode":"\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                )\n            )\n            raise MaskedHTTPStatusError(e, message=_body, text=_body) from None\n        finally:\n            try:\n                await e.response.aclose()\n            except Exception:\n                pass","sourceCodeStart":449,"sourceCodeEnd":485,"githubUrl":"https://github.com/BerriAI/litellm/blob/77b7c6c40c0c5aa5fbcb1d6a1825ac39ca8829b8/litellm/llms/custom_httpx/http_handler.py#L449-L485","documentation":"Masked error for sync non-streaming HTTP handlers: an httpx.HTTPStatusError's response text was read and passed through mask_sensitive_info, then re-raised as MaskedHTTPStatusError so secrets in the error body are redacted.","triggerScenarios":"Thrown at litellm/llms/custom_httpx/http_handler.py:467 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"}