{"record":{"id":"9e286ac2fb7e4b9c","repo":"BerriAI/litellm","slug":"anthropicerror-error-str","errorCode":null,"errorMessage":"AnthropicError - {error_str}","messagePattern":"AnthropicError - (.+?)","errorType":"exception","errorClass":"ContextWindowExceededError","httpStatus":400,"severity":"error","filePath":"litellm/litellm_core_utils/exception_mapping_utils.py","lineNumber":516,"sourceCode":"        )\n\n\ndef _map_anthropic_exception(\n    *,\n    model: str,\n    original_exception: _ProviderHTTPException,\n    custom_llm_provider: str,\n    error_str: str,\n    exception_type: str,\n    exception_provider: str,\n    extra_information: str,\n) -> None:\n    if (\n        \"prompt is too long\" in error_str\n        or \"prompt: length\" in error_str\n        or ExceptionCheckers.is_error_str_context_window_exceeded(error_str)\n    ):\n        raise ContextWindowExceededError(\n            message=f\"AnthropicError - {error_str}\",\n            model=model,\n            llm_provider=\"anthropic\",\n        )\n    elif \"overloaded_error\" in error_str or \"Overloaded\" in error_str:\n        raise InternalServerError(\n            message=f\"AnthropicError - {error_str}\",\n            model=model,\n            llm_provider=\"anthropic\",\n        )\n    if \"Invalid API Key\" in error_str:\n        raise AuthenticationError(\n            message=f\"AnthropicError - {error_str}\",\n            model=model,\n            llm_provider=\"anthropic\",\n        )\n    if \"content filtering policy\" in error_str:\n        raise ContentPolicyViolationError(","sourceCodeStart":498,"sourceCodeEnd":534,"githubUrl":"https://github.com/BerriAI/litellm/blob/6c2dcb801bf2b75c18f1bb24140e7cf57465cc4d/litellm/litellm_core_utils/exception_mapping_utils.py#L498-L534","documentation":"Error \"AnthropicError - {error_str}\" thrown in BerriAI/litellm.","triggerScenarios":"Thrown at litellm/litellm_core_utils/exception_mapping_utils.py:516 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Inspect the Anthropic error string; adjust the request or credentials accordingly."],"exampleFix":null,"handlingStrategy":null,"validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"6c2dcb801bf2b75c18f1bb24140e7cf57465cc4d","analyzedAt":"2026-08-15T07:12:03.035Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}