{"record":{"id":"2450d8f27f12b829","repo":"BerriAI/litellm","slug":"message","errorCode":null,"errorMessage":"{message}","messagePattern":"\\{message\\}","errorType":"http","errorClass":"AnthropicError","httpStatus":500,"severity":"error","filePath":"litellm/llms/anthropic/chat/handler.py","lineNumber":949,"sourceCode":"                        \"stop_reason\": null,\n                        \"stop_sequence\": null,\n                        \"usage\": {\n                            \"input_tokens\": 270,\n                            \"output_tokens\": 1\n                        }\n                    }\n                }\n                \"\"\"\n                message_start_block: Final = MessageStartBlock(**chunk)\n                if \"usage\" in message_start_block[\"message\"]:\n                    usage = self._handle_usage(anthropic_usage_chunk=message_start_block[\"message\"][\"usage\"])\n            elif type_chunk == \"error\":\n                \"\"\"\n                {\"type\":\"error\",\"error\":{\"details\":null,\"type\":\"api_error\",\"message\":\"Internal server error\"}      }\n                \"\"\"\n                _error_dict: Final = chunk.get(\"error\", {}) or {}\n                message: Final = _error_dict.get(\"message\", None) or str(chunk)\n                raise AnthropicError(\n                    message=message,\n                    status_code=500,  # it looks like Anthropic API does not return a status code in the chunk error - default to 500\n                )\n\n            text, tool_use = self._handle_json_mode_chunk(text=text, tool_use=tool_use)\n\n            returned_chunk: Final = ModelResponseStream(\n                choices=[\n                    StreamingChoices(\n                        index=index,\n                        delta=Delta(\n                            content=text,\n                            tool_calls=[tool_use] if tool_use is not None else None,\n                            provider_specific_fields=(provider_specific_fields if provider_specific_fields else None),\n                            thinking_blocks=(thinking_blocks if thinking_blocks else None),\n                            reasoning_content=reasoning_content,\n                        ),\n                        finish_reason=finish_reason,","sourceCodeStart":931,"sourceCodeEnd":967,"githubUrl":"https://github.com/BerriAI/litellm/blob/6c2dcb801bf2b75c18f1bb24140e7cf57465cc4d/litellm/llms/anthropic/chat/handler.py#L931-L967","documentation":"Error \"{message}\" thrown in BerriAI/litellm.","triggerScenarios":"Thrown at litellm/llms/anthropic/chat/handler.py:949 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Inspect the streamed error message from Anthropic."],"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"}