BerriAI/litellm · error · AnthropicError

{e.response.text}

Error message

{e.response.text}

What it means

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

Source

Thrown at litellm/llms/anthropic/count_tokens/handler.py:113

                raise AnthropicError(
                    status_code=response.status_code,
                    message=error_text,
                )

            anthropic_response: Final = response.json()

            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

  1. Inspect the Anthropic API error response text.

When it happens

Trigger: Thrown at litellm/llms/anthropic/count_tokens/handler.py:113 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/03e1dccf5bdba871. Report an issue: GitHub.