BerriAI/litellm · error · AnthropicError

{e}

Error message

{e}

What it means

Error "{e}" thrown in BerriAI/litellm.

Source

Thrown at litellm/llms/anthropic/chat/handler.py:105

            stream=True,
            timeout=timeout,
            logging_obj=logging_obj,
        )
    except httpx.HTTPStatusError as e:
        error_headers = getattr(e, "headers", None)
        error_response: Final = getattr(e, "response", None)
        if error_headers is None and error_response:
            error_headers = getattr(error_response, "headers", None)
        raise AnthropicError(
            status_code=e.response.status_code,
            message=await e.response.aread(),
            headers=error_headers,
        )
    except Exception as e:
        for exception in litellm.LITELLM_EXCEPTION_TYPES:
            if isinstance(e, exception):
                raise e
        raise AnthropicError(status_code=500, message=str(e))

    completion_stream: Final = ModelResponseIterator(
        streaming_response=response.aiter_lines(),
        sync_stream=False,
        json_mode=json_mode,
        speed=speed,
        tool_name_reverse_map=tool_name_reverse_map,
    )

    # LOGGING
    logging_obj.post_call(
        input=messages,
        api_key="",
        original_response=completion_stream,  # Pass the completion stream for logging
        additional_args={"complete_input_dict": data},
    )

    return completion_stream, response.headers

View on GitHub (pinned to 6c2dcb801b)

Solutions

  1. Inspect the wrapped exception for the Anthropic call failure.

When it happens

Trigger: Thrown at litellm/llms/anthropic/chat/handler.py:105 when the library encounters an invalid state.

Common situations: See trigger scenarios.


AI-assisted analysis of BerriAI/litellm@6c2dcb801b (2026-08-15). Data as JSON: /api/errors/64e7ff4c373a97bd. Report an issue: GitHub.