BerriAI/litellm · error · MaskedHTTPStatusError

{masked_response_text}

Error message

{masked_response_text}

What it means

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.

Source

Thrown at litellm/llms/custom_httpx/http_handler.py:467

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,
                )
            )
            raise MaskedHTTPStatusError(e, message=_body, text=_body) from None
        finally:
            try:
                await e.response.aclose()
            except Exception:
                pass

View on GitHub (pinned to 77b7c6c40c)

Solutions

  1. Read the masked response body in the error; the upstream HTTP call returned a non-success status.
  2. 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:467 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/fbf74d9a26bc90dc. Report an issue: GitHub.