ScrapeGraphAI/Scrapegraph-ai · error · ImportError

undetected_chromedriver is required for ChromiumLoader. Plea

Error message

undetected_chromedriver is required for ChromiumLoader. Please install it with `pip install undetected-chromedriver`.

What it means

SearchInternetNode.execute raises ValueError('Zero results found for the search query.') when the configured search engine wrapper returns an empty list. The node treats zero results as fatal rather than passing an empty list downstream, because answer generation would have nothing to work with.

Source

Thrown at scrapegraphai/docloaders/chromium.py:125

            except Exception as e:
                raise ValueError(f"Failed to scrape with undetected chromedriver: {e}")
        else:
            raise ValueError(f"Unsupported backend: {self.backend}")

    async def ascrape_undetected_chromedriver(self, url: str) -> str:
        """
        Asynchronously scrape the content of a given URL using undetected chrome with Selenium.

        Args:
            url (str): The URL to scrape.

        Returns:
            str: The scraped HTML content or an error message if an exception occurs.
        """
        try:
            import undetected_chromedriver as uc
        except ImportError:
            raise ImportError(
                "undetected_chromedriver is required for ChromiumLoader. Please install it with `pip install undetected-chromedriver`."
            )

        logger.info(f"Starting scraping with {self.backend}...")
        results = ""
        attempt = 0

        while attempt < self.retry_limit:
            try:
                async with async_timeout.timeout(self.timeout):
                    # Handling browser selection
                    if self.backend == "selenium":
                        if self.browser_name == "chromium":
                            from selenium.webdriver.chrome.options import (
                                Options as ChromeOptions,
                            )

                            options = ChromeOptions()

View on GitHub (pinned to 532dfffbf6)

Solutions

  1. Verify search engine credentials (e.g. serper_api_key) are set and valid when using engines that require them.
  2. Broaden or rephrase the query, remove exact-match quotes, and retry.
  3. Try a different search_engine value (e.g. 'duckduckgo' vs 'google') to rule out engine-specific blocks/rate limits.
  4. If empty results are expected, wrap the graph run and handle this ValueError as a normal 'no results' outcome.

Example fix

# before
config = {"llm": {...}, "search_engine": "seper"}  # typo'd/no key

# after
config = {
    "llm": {...},
    "search_engine": "seper",
    "serper_api_key": os.getenv("SERPER_APIKEY"),
}
Defensive patterns

Strategy: retry

Validate before calling

if not query or not query.strip():
    raise ValueError("Search query must be non-empty")

Type guard

null

Try / catch

for engine in ("duckduckgo", "google", "seper"):
    try:
        config["search_engine"] = engine
        result = search_graph.run()
        break
    except ValueError as e:
        if "Zero results" not in str(e):
            raise

Prevention

When it happens

Trigger: Calling a SearchGraph whose query is too narrow, in a language the engine handles poorly, with a misspelled term, or when the search backend (Google/GoogleSerp/DuckDuckGo/Seper) returns no rows; also when an invalid/absent API key silently yields empty results on some engines.

Common situations: Missing or expired Serper API key; overly specific queries (quoted long strings, rare IDs); rate limits or regional blocks on DuckDuckGo/Google scraping; switching search_engine in config without providing the matching credentials.

Related errors


AI-assisted analysis of ScrapeGraphAI/Scrapegraph-ai@532dfffbf6 (2026-08-28). Data as JSON: /api/errors/eaebacc5477cdde7. Report an issue: GitHub.