BerriAI/litellm · error · AnthropicError
CountTokens processing error: {e}
Error message
CountTokens processing error: {e} What it means
Error "CountTokens processing error: {e}" thrown in BerriAI/litellm.
Source
Thrown at litellm/llms/anthropic/count_tokens/handler.py:119
verbose_logger.debug("Anthropic response: %s", anthropic_response)
# Return Anthropic response directly - no transformation needed
return anthropic_response
except AnthropicError:
# Re-raise Anthropic exceptions as-is
raise
except httpx.HTTPStatusError as e:
# HTTP errors - preserve the actual status code
verbose_logger.error("HTTP error in CountTokens handler: %s", e)
raise AnthropicError(
status_code=e.response.status_code,
message=e.response.text,
)
except Exception as e:
verbose_logger.error("Error in CountTokens handler: %s", e)
raise AnthropicError(
status_code=500,
message=f"CountTokens processing error: {e}",
)
View on GitHub (pinned to 6c2dcb801b)
Solutions
- Check the count-tokens request payload; see the wrapped exception.
When it happens
Trigger: Thrown at litellm/llms/anthropic/count_tokens/handler.py:119 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/b431d83db54541b3.
Report an issue: GitHub.