{"record":{"id":"52d7ca95da8d7912","repo":"huggingface/smolagents","slug":"unsupported-engine-self-engine","errorCode":null,"errorMessage":"Unsupported engine: {self.engine}","messagePattern":"Unsupported engine: (.+?)","errorType":"validation","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"src/smolagents/default_tools.py","lineNumber":367,"sourceCode":"        super().__init__()\n        self.max_results = max_results\n        self.engine = engine\n\n    def forward(self, query: str) -> str:\n        results = self.search(query)\n        if len(results) == 0:\n            raise Exception(\"No results found! Try a less restrictive/shorter query.\")\n        return self.parse_results(results)\n\n    def search(self, query: str) -> list:\n        if self.engine == \"duckduckgo\":\n            return self.search_duckduckgo(query)\n        elif self.engine == \"bing\":\n            return self.search_bing(query)\n        elif self.engine == \"exa\":\n            return self.search_exa(query)\n        else:\n            raise ValueError(f\"Unsupported engine: {self.engine}\")\n\n    def parse_results(self, results: list) -> str:\n        return \"## Search Results\\n\\n\" + \"\\n\\n\".join(\n            [f\"[{result['title']}]({result['link']})\\n{result['description']}\" for result in results]\n        )\n\n    def search_duckduckgo(self, query: str) -> list:\n        import requests\n\n        response = requests.get(\n            \"https://lite.duckduckgo.com/lite/\",\n            params={\"q\": query},\n            headers={\"User-Agent\": \"Mozilla/5.0\"},\n        )\n        response.raise_for_status()\n        parser = self._create_duckduckgo_parser()\n        parser.feed(response.text)\n        return parser.results","sourceCodeStart":349,"sourceCodeEnd":385,"githubUrl":"https://github.com/huggingface/smolagents/blob/30bb1161095dbae2271e6bc3cc4c219cc3897a57/src/smolagents/default_tools.py#L349-L385","documentation":"Raised by SearchEngineTool.search when self.engine is not one of 'duckduckgo', 'bing', or 'exa'. It is the terminal else of the engine dispatch — any other engine string is rejected at search time (not construction time), which is a common surprise.","triggerScenarios":"Constructing SearchEngineTool(engine='google') or any misspelled engine value ('DuckDuckGo', 'exaa') and then calling search/forward — the constructor accepts it, the error only appears on first search.","commonSituations":"Assuming Google support, case mismatches, or validating config at construction and being surprised the error surfaces later during agent runs.","solutions":["Use exactly 'duckduckgo', 'bing', or 'exa' as the engine value.","Validate the engine at construction time in your own wrapper (see exampleFix) so it fails fast."],"exampleFix":"# before\ntool = SearchEngineTool(engine='google'); tool.run('x')\n# after\nVALID = {'duckduckgo','bing','exa'}\nassert tool.engine in VALID, f'engine must be one of {VALID}'\ntool = SearchEngineTool(engine='exa')","handlingStrategy":"validation","validationCode":"VALID = {'duckduckgo','bing','exa'}\nassert engine in VALID, f'engine must be one of {sorted(VALID)}'","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Validate engine at construction, since the tool itself only validates at search time.","Use lowercase exact strings; don't rely on case-insensitivity."],"tags":["search-tool","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"}