{"record":{"id":"fdc98565847c751e","repo":"huggingface/smolagents","slug":"tool-tool-name-is-not-recognized-either-as-a-def","errorCode":null,"errorMessage":"Tool {tool_name} is not recognized either as a default tool or a Space.","messagePattern":"Tool (.+?) is not recognized either as a default tool or a Space\\.","errorType":"validation","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"src/smolagents/cli.py","lineNumber":245,"sourceCode":"    provider: str | None = None,\n    action_type: str = \"code\",\n) -> None:\n    load_dotenv()\n\n    model = load_model(model_type, model_id, api_base=api_base, api_key=api_key, provider=provider)\n\n    available_tools = []\n\n    for tool_name in tools:\n        if \"/\" in tool_name:\n            space_name = tool_name.split(\"/\")[-1].lower().replace(\"-\", \"_\").replace(\".\", \"_\")\n            description = f\"Tool loaded from Hugging Face Space: {tool_name}\"\n            available_tools.append(Tool.from_space(space_id=tool_name, name=space_name, description=description))\n        else:\n            if tool_name in TOOL_MAPPING:\n                available_tools.append(TOOL_MAPPING[tool_name]())\n            else:\n                raise ValueError(f\"Tool {tool_name} is not recognized either as a default tool or a Space.\")\n\n    if action_type == \"code\":\n        agent = CodeAgent(\n            tools=available_tools,\n            model=model,\n            additional_authorized_imports=imports,\n            stream_outputs=True,\n        )\n    elif action_type == \"tool_calling\":\n        agent = ToolCallingAgent(tools=available_tools, model=model, stream_outputs=True)\n    else:\n        raise ValueError(f\"Unsupported action type: {action_type}\")\n\n    agent.run(prompt)\n\n\ndef main() -> None:\n    args = parse_arguments()","sourceCodeStart":227,"sourceCodeEnd":263,"githubUrl":"https://github.com/huggingface/smolagents/blob/30bb1161095dbae2271e6bc3cc4c219cc3897a57/src/smolagents/cli.py#L227-L263","documentation":"Raised by run_smolagent in the smolagents CLI when a tool name passed via --tools is neither a key in TOOL_MAPPING (built-in default tools) nor resolvable as a Hugging Face Space. The CLI resolves each tool name in order: Space check, then default tool mapping, then raises this ValueError.","triggerScenarios":"Passing an unknown tool name to `smolagent --tools unknown_tool_name`, a typo of a default tool (e.g. 'web_serach'), or a Space ID that doesn't exist / isn't detected as a Space so it falls through to the mapping lookup and misses.","commonSituations":"Misspelling default tool names, referencing a tool that exists in the docs but not in the installed version's TOOL_MAPPING, or passing a nonexistent Space ID.","solutions":["Check TOOL_MAPPING keys in smolagents/default_tools.py for the installed version and use the exact tool name.","If you meant a Space, verify the Space ID exists on huggingface.co and is reachable.","Upgrade smolagents if the tool was added in a newer release."],"exampleFix":"# before\nsmolagent --tools web_serach --prompt \"hi\"\n# after\nsmolagent --tools web_search --prompt \"hi\"","handlingStrategy":"validation","validationCode":"from smolagents.default_tools import TOOL_MAPPING\nassert tool_name in TOOL_MAPPING, f'{tool_name} not a default tool; check TOOL_MAPPING keys'","typeGuard":null,"tryCatchPattern":null,"preventionTips":["List TOOL_MAPPING.keys() at startup and validate CLI --tools values against it.","Validate Space IDs exist via the Hub API before passing them."],"tags":["cli","tools","input-validation","smolagents"],"backgroundTag":"invalid-argument-value","analyzedSha":"30bb1161095dbae2271e6bc3cc4c219cc3897a57","analyzedAt":"2026-08-28T18:52:54.169Z","schemaVersion":2},"datasetVersion":"2026-08-28T21:17:43.275Z"}