ScrapeGraphAI/Scrapegraph-ai · error · SearchConfigError
Invalid search configuration: {str(e)}
Error message
Invalid search configuration: {str(e)} What it means
Raised by search_on_web when engine-specific validation fails with ValueError before/during the search, wrapped into SearchConfigError. It signals a malformed configuration rather than a network problem.
Source
Thrown at scrapegraphai/utils/research_web.py:243
elif config.search_engine == "searxng":
results = _search_searxng(
config.query, config.max_results, config.port, config.timeout
)
elif config.search_engine == "serper":
results = _search_serper(
config.query, config.max_results, config.serper_api_key, config.timeout
)
return filter_pdf_links(results)
except requests.Timeout:
raise TimeoutError(f"Search request timed out after {timeout} seconds")
except requests.RequestException as e:
raise SearchRequestError(f"Search request failed: {str(e)}")
except ValueError as e:
raise SearchConfigError(f"Invalid search configuration: {str(e)}")
def _search_duckduckgo(
query: str, max_results: int, proxy: Optional[str] = None
) -> List[str]:
"""
Helper function for DuckDuckGo search using the ``ddgs`` package.
The ``duckduckgo-search`` package was renamed to ``ddgs``; recent
``langchain-community`` releases import ``from ddgs import DDGS``, which
silently broke the previous langchain-based implementation. This calls
``ddgs`` directly so results no longer depend on parsing a formatted string.
Args:
query (str): Search query
max_results (int): Maximum number of results to return
proxy (str, optional): Proxy configuration
View on GitHub (pinned to 532dfffbf6)
Solutions
- Check the engine string against supported engines (google, bing, duckduckgo, searxng, serper)
- Validate max_results and timeout are positive ints before calling
- Upgrade scrapegraphai if the engine was added in a newer release
Example fix
// before config = SearchConfig(query="x", search_engine="googel") // after config = SearchConfig(query="x", search_engine="google")
Defensive patterns
Strategy: validation
Validate before calling
SUPPORTED = {"google", "bing", "duckduckgo", "searxng", "serper"}
assert config.search_engine in SUPPORTED, f"unknown engine {config.search_engine}"
assert isinstance(config.max_results, int) and config.max_results > 0 Type guard
def is_valid_engine(name: str) -> bool:
return name in {"google", "bing", "duckduckgo", "searxng", "serper"} Try / catch
try:
results = search_on_web(config)
except SearchConfigError as e:
raise ValueError(f"fix search config: {e}") from e Prevention
- Validate the engine string against the docs before calling
- Keep engine names lowercase and spelled exactly
- Fail fast on config errors instead of retrying
When it happens
Trigger: Calling search_on_web with an invalid or missing search engine name, a bad max_results value, or a malformed query that a backend validates with ValueError. The test_invalid_search_engine case shows an unknown engine string triggers it.
Common situations: Typos in the engine name ('googel' vs 'google'), passing an engine not supported by the installed version, wrong types for max_results/timeout.
Understand the failure class
Background: "Invalid value" and "allowed values are" config errors: what your library rejected and how to fix it — this error's family across 41 libraries.
Related errors
- The browserbase module is not installed. Please install it u
- Search engine must be one of: {', '.join(valid_engines)}
- LLM configuration must include an 'api_key'.
- langchain_google_genai is not installed. Please install it u
- The 'graphviz' library is required for this functionality. P
AI-assisted analysis of ScrapeGraphAI/Scrapegraph-ai@532dfffbf6 (2026-08-28).
Data as JSON: /api/errors/7080ce153ade2ba7.
Report an issue: GitHub.