BerriAI/litellm · error · Timeout
AnthropicException Timeout
Error message
AnthropicException Timeout - {error_str} What it means
Anthropic-specific status mapping: an upstream Anthropic error with HTTP 503 is re-raised as ServiceUnavailableError (timeout-class), signaling Anthropic is temporarily unavailable; the message suggests handling via litellm.ServiceUnavailableError.
Solutions
- Increase the timeout for Anthropic requests or retry.
- Reduce request size if the model takes too long to respond.
Defensive patterns
Strategy: retry
When it happens
Trigger: Thrown at litellm/litellm_core_utils/exception_mapping_utils.py:599 when the library encounters an invalid state.
Common situations: See trigger scenarios.
Understand the failure class
- Timeouts: ETIMEDOUT, deadlines, and hung requests — what actually expires when a request times out.
AI-assisted analysis of BerriAI/litellm@77b7c6c40c (2026-08-18).
Data as JSON: /api/errors/9d1b7e706e1d0fc7.
Report an issue: GitHub.
Appendix: source
Thrown at litellm/litellm_core_utils/exception_mapping_utils.py:599
model=model,
response=getattr(original_exception, "response", None),
)
elif original_exception.status_code == 502:
raise BadGatewayError(
message=f"AnthropicException BadGatewayError - {error_str}",
llm_provider="anthropic",
model=model,
response=getattr(original_exception, "response", None),
)
elif original_exception.status_code == 503:
raise litellm.ServiceUnavailableError(
message=f"AnthropicException - {error_str}. Handle with `litellm.ServiceUnavailableError`.",
llm_provider="anthropic",
model=model,
response=getattr(original_exception, "response", None),
)
elif original_exception.status_code == 504: # gateway timeout error
raise Timeout(
message=f"AnthropicException Timeout - {error_str}",
model=model,
llm_provider="anthropic",
exception_status_code=original_exception.status_code,
)
def _map_replicate_exception(
*,
model: str,
original_exception: _ProviderHTTPException,
custom_llm_provider: str,
error_str: str,
exception_type: str,
exception_provider: str,
extra_information: str,
) -> None:
if "Incorrect authentication token" in error_str:View on GitHub (pinned to 77b7c6c40c)