huggingface/smolagents · error · ValueError
Unsupported engine: {self.engine}
Error message
Unsupported engine: {self.engine} What it means
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.
Source
Thrown at src/smolagents/default_tools.py:367
super().__init__()
self.max_results = max_results
self.engine = engine
def forward(self, query: str) -> str:
results = self.search(query)
if len(results) == 0:
raise Exception("No results found! Try a less restrictive/shorter query.")
return self.parse_results(results)
def search(self, query: str) -> list:
if self.engine == "duckduckgo":
return self.search_duckduckgo(query)
elif self.engine == "bing":
return self.search_bing(query)
elif self.engine == "exa":
return self.search_exa(query)
else:
raise ValueError(f"Unsupported engine: {self.engine}")
def parse_results(self, results: list) -> str:
return "## Search Results\n\n" + "\n\n".join(
[f"[{result['title']}]({result['link']})\n{result['description']}" for result in results]
)
def search_duckduckgo(self, query: str) -> list:
import requests
response = requests.get(
"https://lite.duckduckgo.com/lite/",
params={"q": query},
headers={"User-Agent": "Mozilla/5.0"},
)
response.raise_for_status()
parser = self._create_duckduckgo_parser()
parser.feed(response.text)
return parser.resultsView on GitHub (pinned to 30bb116109)
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.
Example fix
# before
tool = SearchEngineTool(engine='google'); tool.run('x')
# after
VALID = {'duckduckgo','bing','exa'}
assert tool.engine in VALID, f'engine must be one of {VALID}'
tool = SearchEngineTool(engine='exa') Defensive patterns
Strategy: validation
Validate before calling
VALID = {'duckduckgo','bing','exa'}
assert engine in VALID, f'engine must be one of {sorted(VALID)}' Prevention
- Validate engine at construction, since the tool itself only validates at search time.
- Use lowercase exact strings; don't rely on case-insensitivity.
When it happens
Trigger: 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.
Common situations: Assuming Google support, case mismatches, or validating config at construction and being surprised the error surfaces later during agent runs.
Understand the failure class
Background: "Must be a positive integer", "Invalid value", "Unsupported": the invalid-argument-value error family, when a library rejects the value you pass — this error's family across 35 libraries.
Related errors
- Only 'markdown' is supported for a string argument to `code_
- Unsupported model type: {model_type}
- Tool {tool_name} is not recognized either as a default tool
- Unsupported action type: {action_type}
- You must install package `ddgs` to run this tool: for instan
AI-assisted analysis of huggingface/smolagents@30bb116109 (2026-08-28).
Data as JSON: /api/errors/52d7ca95da8d7912.
Report an issue: GitHub.