{"record":{"id":"8127354fae33233a","repo":"BerriAI/litellm","slug":"advisor-tool-must-have-a-valid-model","errorCode":null,"errorMessage":"Advisor tool must have a valid model","messagePattern":"Advisor tool must have a valid model","errorType":"validation","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"litellm/llms/anthropic/chat/transformation.py","lineNumber":759,"sourceCode":"        elif tool[\"type\"] == \"tool_search_tool_bm25_20251119\":\n            # Tool search tool using BM25\n            from litellm.types.llms.anthropic import AnthropicToolSearchToolBM25\n\n            tool_name_obj = tool.get(\"name\", \"tool_search_tool_bm25\")\n            if not isinstance(tool_name_obj, str):\n                raise ValueError(\"Tool search tool must have a valid name\")\n            tool_name = tool_name_obj\n            returned_tool = AnthropicToolSearchToolBM25(\n                type=\"tool_search_tool_bm25_20251119\",\n                name=tool_name,\n            )\n        elif tool[\"type\"] == ANTHROPIC_ADVISOR_TOOL_TYPE:\n            from litellm.types.llms.anthropic import AnthropicAdvisorTool\n\n            _tool_dict: Final = cast(dict, tool)\n            advisor_model: Final = _tool_dict.get(\"model\")\n            if not isinstance(advisor_model, str):\n                raise ValueError(\"Advisor tool must have a valid model\")\n            _advisor_tool: Final = AnthropicAdvisorTool(\n                type=ANTHROPIC_ADVISOR_TOOL_TYPE,\n                name=\"advisor\",\n                model=advisor_model,\n            )\n            if _tool_dict.get(\"max_uses\") is not None:\n                _advisor_tool[\"max_uses\"] = _tool_dict[\"max_uses\"]\n            if _tool_dict.get(\"caching\") is not None:\n                _advisor_tool[\"caching\"] = _tool_dict[\"caching\"]\n            returned_tool = _advisor_tool\n        if returned_tool is None and mcp_server is None:\n            raise ValueError(f\"Unsupported tool type: {tool['type']}\")\n\n        ## check if cache_control is set in the tool\n        _cache_control: Final = tool.get(\"cache_control\", None)\n        _cache_control_function: Final = tool.get(\"function\", {}).get(\"cache_control\", None)\n        if returned_tool is not None:\n            # Only set cache_control on tools that support it (not tool search tools)","sourceCodeStart":741,"sourceCodeEnd":777,"githubUrl":"https://github.com/BerriAI/litellm/blob/77b7c6c40c0c5aa5fbcb1d6a1825ac39ca8829b8/litellm/llms/anthropic/chat/transformation.py#L741-L777","documentation":"Tool-mapping guard in the Anthropic chat transformation: the advisor tool's model field is missing or not a valid string, so the tool cannot be constructed with a routable model.","triggerScenarios":"Thrown at litellm/llms/anthropic/chat/transformation.py:759 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Set a valid 'model' field on the advisor tool definition."],"exampleFix":null,"handlingStrategy":"type-guard","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"}