BerriAI/litellm · error · MaskedHTTPStatusError
{masked_response_body}
Error message
{masked_response_body} What it means
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.
Source
Thrown at litellm/llms/custom_httpx/http_handler.py:460
except Exception:
response.close()
return b""
return response.read()
except Exception:
return b""
def _raise_masked_sync_error(e: httpx.HTTPStatusError, stream: bool) -> None:
"""Raise a MaskedHTTPStatusError for sync HTTP handlers."""
if stream:
try:
_body: Final = mask_sensitive_info(
_safe_read_response(
e.response,
timeout=_STREAMING_ERROR_BODY_READ_TIMEOUT_SECONDS,
)
)
raise MaskedHTTPStatusError(e, message=_body, text=_body) from None
finally:
try:
e.response.close()
except Exception:
pass
_text: Final = mask_sensitive_info(_safe_get_response_text(e.response))
raise MaskedHTTPStatusError(e, message=_text, text=_text) from None
async def _raise_masked_async_error(e: httpx.HTTPStatusError, stream: bool) -> None:
"""Raise a MaskedHTTPStatusError for async HTTP handlers."""
if stream:
try:
_body: Final = mask_sensitive_info(
await _safe_aread_response(
e.response,
timeout=_STREAMING_ERROR_BODY_READ_TIMEOUT_SECONDS,
)View on GitHub (pinned to 77b7c6c40c)
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.
Defensive patterns
Strategy: try-catch
When it happens
Trigger: Thrown at litellm/llms/custom_httpx/http_handler.py:460 when the library encounters an invalid state.
Common situations: See trigger scenarios.
AI-assisted analysis of BerriAI/litellm@77b7c6c40c (2026-08-18).
Data as JSON: /api/errors/27d6e5d1948fbe8e.
Report an issue: GitHub.