BerriAI/litellm · error · AnthropicError
{response_body}
Error message
{response_body} What it means
Error "{response_body}" thrown in BerriAI/litellm.
Source
Thrown at litellm/llms/anthropic/chat/handler.py:96
) -> tuple[Any, httpx.Headers]:
if client is None:
client = litellm.module_level_aclient
try:
response: Final = await client.post(
api_base,
headers=headers,
data=data,
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,
)
View on GitHub (pinned to 6c2dcb801b)
Solutions
- Inspect the Anthropic response body for the error detail.
When it happens
Trigger: Thrown at litellm/llms/anthropic/chat/handler.py:96 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/7be09555ac4f8245.
Report an issue: GitHub.