{"record":{"id":"2ae11330f45b4f6c","repo":"BerriAI/litellm","slug":"bad-request-messages-is-required-for-anthropic-me","errorCode":null,"errorMessage":"Bad Request: messages is required for Anthropic Messages Request","messagePattern":"Bad Request: messages is required for Anthropic Messages Request","errorType":"validation","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"litellm/llms/anthropic/experimental_pass_through/adapters/transformation.py","lineNumber":172,"sourceCode":"        Translate Anthropic request params to OpenAI format, returning tool name mapping.\n\n        This method handles truncation of tool names that exceed OpenAI's 64-character\n        limit. The mapping allows restoring original names when translating responses.\n\n        Returns:\n            Tuple of (openai_request, tool_name_mapping)\n            - tool_name_mapping maps truncated tool names back to original names\n        \"\"\"\n\n        #########################################################\n        # Validate required params\n        #########################################################\n        model: Final = kwargs.pop(\"model\")\n        messages: Final = kwargs.pop(\"messages\")\n        if not model:\n            raise ValueError(\"Bad Request: model is required for Anthropic Messages Request\")\n        if not messages:\n            raise ValueError(\"Bad Request: messages is required for Anthropic Messages Request\")\n\n        #########################################################\n        # Created Typed Request Body\n        #########################################################\n        request_body: Final = AnthropicMessagesRequest(model=model, messages=messages, **kwargs)\n\n        (\n            translated_body,\n            tool_name_mapping,\n        ) = LiteLLMAnthropicMessagesAdapter().translate_anthropic_to_openai(anthropic_message_request=request_body)\n\n        return translated_body, tool_name_mapping\n\n    def translate_completion_output_params(\n        self,\n        response: ModelResponse,\n        tool_name_mapping: dict[str, str] | None = None,\n        polyfill_result: PolyfillResult | None = None,","sourceCodeStart":154,"sourceCodeEnd":190,"githubUrl":"https://github.com/BerriAI/litellm/blob/77b7c6c40c0c5aa5fbcb1d6a1825ac39ca8829b8/litellm/llms/anthropic/experimental_pass_through/adapters/transformation.py#L154-L190","documentation":"Error \"Bad Request: messages is required for Anthropic Messages Request\" thrown in BerriAI/litellm.","triggerScenarios":"Thrown at litellm/llms/anthropic/experimental_pass_through/adapters/transformation.py:172 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Include 'messages' in the Anthropic Messages request body."],"exampleFix":null,"handlingStrategy":null,"validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"77b7c6c40c0c5aa5fbcb1d6a1825ac39ca8829b8","analyzedAt":"2026-08-18T11:44:31.656Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}