{"record":{"id":"af12333bc5d93e1d","repo":"BerriAI/litellm","slug":"missing-required-parameter-name","errorCode":null,"errorMessage":"Missing required parameter: name","messagePattern":"Missing required parameter: name","errorType":"validation","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"litellm/llms/anthropic/chat/transformation.py","lineNumber":712,"sourceCode":"            if _display_width_px is None or _display_height_px is None:\n                raise ValueError(\"Missing required parameter: display_width_px or display_height_px\")\n\n            _computer_tool: Final = AnthropicComputerTool(\n                type=tool[\"type\"],\n                name=tool[\"function\"].get(\"name\", \"computer\"),\n                display_width_px=_display_width_px,\n                display_height_px=_display_height_px,\n            )\n\n            _display_number: Final = tool[\"function\"][\"parameters\"].get(\"display_number\")\n            if _display_number is not None:\n                _computer_tool[\"display_number\"] = _display_number\n\n            returned_tool = _computer_tool\n        elif any(tool[\"type\"].startswith(t) for t in ANTHROPIC_HOSTED_TOOLS):\n            function_name_obj: Final = tool.get(\"name\", tool.get(\"function\", {}).get(\"name\"))\n            if function_name_obj is None or not isinstance(function_name_obj, str):\n                raise ValueError(\"Missing required parameter: name\")\n            function_name: Final = function_name_obj\n\n            additional_tool_params: Final = {}\n            for k, v in tool.items():\n                if k != \"type\" and k != \"name\":\n                    additional_tool_params[k] = v\n\n            returned_tool = AnthropicHostedTools(\n                type=tool[\"type\"],\n                name=function_name,\n                **additional_tool_params,\n            )\n        elif tool[\"type\"] == \"url\":  # mcp server tool\n            mcp_server = AnthropicMcpServerTool(**tool)\n        elif tool[\"type\"] == \"mcp\":\n            mcp_server = self._map_openai_mcp_server_tool(cast(OpenAIMcpServerTool, tool))\n        elif tool[\"type\"] == \"tool_search_tool_regex_20251119\":\n            # Tool search tool using regex","sourceCodeStart":694,"sourceCodeEnd":730,"githubUrl":"https://github.com/BerriAI/litellm/blob/6c2dcb801bf2b75c18f1bb24140e7cf57465cc4d/litellm/llms/anthropic/chat/transformation.py#L694-L730","documentation":"For Anthropic hosted tools (types in ANTHROPIC_HOSTED_TOOLS, e.g. web_search, code_execution), LiteLLM requires a 'name' — read from tool['name'] or tool['function']['name'] — and it must be a string. If neither location holds a string name, this ValueError aborts request transformation.","triggerScenarios":"Passing a hosted tool like {'type': 'web_search_20250305'} with no name at either level, or with name set to a non-string (dict, None, number); mixing OpenAI-style {'type': 'function', 'function': {...}} shapes with Anthropic hosted tool types.","commonSituations":"Porting raw Anthropic SDK tool dicts (which use {'type': 'web_search_20250305', 'name': 'web_search'}) through code that strips the top-level name; schemas generated by other frameworks that omit name for non-function tools.","solutions":["Include a string 'name' for hosted tools, either at the top level or under 'function'.","Use the conventional name for the tool family (e.g. 'web_search', 'code_execution') or match Anthropic's docs.","If the tool came from the Anthropic SDK, pass it through as-is rather than rebuilding it without name.","Pre-validate hosted tools have a string name before calling completion()."],"exampleFix":"# before\ntools = [{\"type\": \"web_search_20250305\", \"max_uses\": 3}]\n\n# after\ntools = [{\"type\": \"web_search_20250305\", \"name\": \"web_search\", \"max_uses\": 3}]","handlingStrategy":"validation","validationCode":"def validate_hosted_tools(tools, hosted_types):\n    for t in tools:\n        if any(str(t.get(\"type\", \"\")).startswith(h) for h in hosted_types):\n            name = t.get(\"name\") or t.get(\"function\", {}).get(\"name\")\n            if not isinstance(name, str) or not name:\n                raise ValueError(f\"hosted tool '{t['type']}' missing string 'name'\")\n    return tools","typeGuard":"def hosted_tool_has_name(tool) -> bool:\n    name = tool.get(\"name\") or tool.get(\"function\", {}).get(\"name\")\n    return isinstance(name, str) and len(name) > 0","tryCatchPattern":null,"preventionTips":["Pass raw Anthropic SDK hosted-tool dicts through unchanged.","Use one canonical name per hosted tool family in your codebase."],"tags":["anthropic","tools","hosted-tools","validation"],"backgroundTag":null,"analyzedSha":"6c2dcb801bf2b75c18f1bb24140e7cf57465cc4d","analyzedAt":"2026-08-15T07:12:03.035Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}