BerriAI/litellm · error · ValueError
Failed to parse Anthropic batch response: {e}
Error message
Failed to parse Anthropic batch response: {e} What it means
Error "Failed to parse Anthropic batch response: {e}" thrown in BerriAI/litellm.
Source
Thrown at litellm/llms/anthropic/batches/transformation.py:157
For Anthropic, the URL is constructed by get_retrieve_batch_url(),
so this method returns an empty dict (no additional request params needed).
"""
# No additional request params needed - URL is handled by get_retrieve_batch_url
return {}
def transform_retrieve_batch_response(
self,
model: str | None,
raw_response: httpx.Response,
logging_obj: LoggingClass,
litellm_params: dict,
) -> LiteLLMBatch:
"""Transform Anthropic MessageBatch retrieval response to LiteLLM format."""
try:
response_data: Final = raw_response.json()
except Exception as e:
raise ValueError(f"Failed to parse Anthropic batch response: {e}")
# Map Anthropic MessageBatch to OpenAI Batch format
batch_id: Final = response_data.get("id", "")
processing_status: Final = response_data.get("processing_status", "in_progress")
# Map Anthropic processing_status to OpenAI status
status_mapping: dict[
str,
Literal[
"validating",
"failed",
"in_progress",
"finalizing",
"completed",
"expired",
"cancelling",
"cancelled",
],View on GitHub (pinned to 6c2dcb801b)
Solutions
- Check the Anthropic batch response format; see the wrapped exception.
When it happens
Trigger: Thrown at litellm/llms/anthropic/batches/transformation.py:157 when the library encounters an invalid state.
Common situations: See trigger scenarios.
Understand the failure class
- Parsing and encoding errors: unexpected token, malformed input — why parsers reject input and how to find the real culprit.
AI-assisted analysis of BerriAI/litellm@6c2dcb801b (2026-08-15).
Data as JSON: /api/errors/554d33aae942e900.
Report an issue: GitHub.