ScrapeGraphAI/Scrapegraph-ai · error · ImportError

The browserbase module is not installed. …

Error message

The browserbase module is not installed.
                                      Please install it using `pip install browserbase`.

What it means

When browser_base config is provided, handle_web_source imports scrapegraphai.docloaders.browser_base.browser_base_fetch; if that import fails (missing browserbase dependencies), this ImportError with install instructions is raised.

Solutions

  1. pip install browserbase (and check scrapegraphai optional extras for browserbase support)
  2. Verify the import works: python -c 'from scrapegraphai.docloaders.browser_base import browser_base_fetch'
  3. If BrowserBase is not needed, remove the browser_base config so the default fetcher is used

Example fix

# shell
pip install browserbase
# config stays the same:
node_config = {'browser_base': {'api_key': '...', 'session_id': '...'}}
Defensive patterns

Strategy: validation

Validate before calling

def browserbase_available() -> bool:
    try:
        from scrapegraphai.docloaders.browser_base import browser_base_fetch  # noqa
        return True
    except ImportError:
        return False

if config.get('browser_base') and not browserbase_available():
    config.pop('browser_base')  # or fail fast with a clear message

Try / catch

try:
    graph.run()
except ImportError as e:
    if 'browserbase' in str(e):
        raise SystemExit('Install browserbase: pip install browserbase') from e
    raise

Prevention

When it happens

Trigger: Setting node_config with browser_base={'api_key':...,'session_id':...} while the browserbase package (and its deps) are not installed in the environment.

Common situations: Opting into BrowserBase fetching for the first time; CI/minimal installs lacking optional scraping deps; version drift where the docloader module moved.

Understand the failure class

Background: "X is not installed. Please install it with pip install Y": missing optional dependency errors — ImportError/ValueError raised when a library's optional extra was never installed — this error's family across 22 libraries.

Related errors


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

Appendix: source

Thrown at scrapegraphai/nodes/fetch_node.py:324

                self.logger.warning(
                    f"Failed to retrieve contents from the webpage at url: {source}"
                )
        else:
            loader_kwargs = {}

            if self.node_config:
                loader_kwargs = self.node_config.get("loader_kwargs", {})

            # If a global timeout is configured on the node and no loader-specific timeout
            # was provided, propagate it to ChromiumLoader so it can apply the same limit.
            if "timeout" not in loader_kwargs and self.timeout is not None:
                loader_kwargs["timeout"] = self.timeout

            if self.browser_base:
                try:
                    from ..docloaders.browser_base import browser_base_fetch
                except ImportError:
                    raise ImportError(
                        """The browserbase module is not installed.
                                      Please install it using `pip install browserbase`."""
                    )

                data = browser_base_fetch(
                    self.browser_base.get("api_key"),
                    self.browser_base.get("project_id"),
                    [source],
                )

                document = [
                    Document(page_content=content, metadata={"source": source})
                    for content in data
                ]
            elif self.scrape_do:
                from ..docloaders.scrape_do import scrape_do_fetch

                if (

View on GitHub (pinned to 532dfffbf6)