ScrapeGraphAI/Scrapegraph-ai · error · ValueError
No HTML body content found in
Error message
No HTML body content found in
the document fetched by ChromiumLoader. What it means
After ChromiumLoader.load() returns, handle_web_source checks that a document exists and its first page_content is non-empty; headless Chromium rendered a page with no text content (or returned no documents), so there is nothing to parse.
Source
Thrown at scrapegraphai/nodes/fetch_node.py:381
[source],
output_format=plasmate_cfg.get("output_format", "text"),
timeout=plasmate_cfg.get("timeout", self.timeout or 30),
selector=plasmate_cfg.get("selector"),
extra_headers=plasmate_cfg.get("extra_headers", {}),
fallback_to_chrome=plasmate_cfg.get("fallback_to_chrome", False),
)
document = loader.load()
else:
loader = ChromiumLoader(
[source],
headless=self.headless,
storage_state=self.storage_state,
**loader_kwargs,
)
document = loader.load()
if not document or not document[0].page_content.strip():
raise ValueError(
"""No HTML body content found in
the document fetched by ChromiumLoader."""
)
parsed_content = document[0].page_content
if (
(
isinstance(self.llm_model, ChatOpenAI)
or isinstance(self.llm_model, AzureChatOpenAI)
)
and not self.script_creator
or self.force
and not self.script_creator
and not self.openai_md_enabled
):
parsed_content = convert_to_md(document[0].page_content, parsed_content)
View on GitHub (pinned to 532dfffbf6)
Solutions
- Increase loader/wait timeouts or set headless=False for protected sites
- Use BrowserBase or a proxy-enabled fetch for bot-protected targets
- Verify the URL renders content in a real browser
- Add a retry — sometimes the first render races page load
Example fix
# before
graph_config = {'source': url, 'headless': True}
# after
graph_config = {'source': url, 'headless': False} Defensive patterns
Strategy: fallback
Validate before calling
from scrapegraphai.docloaders.chromium import ChromiumLoader
loader = ChromiumLoader([url], headless=True)
doc = loader.load()
if not doc or not doc[0].page_content.strip():
graph_config['headless'] = False # pre-empt empty render Try / catch
try:
graph.run()
except ValueError as e:
if 'ChromiumLoader' in str(e):
graph_config['headless'] = False
graph.run() # retry headed
else:
raise Prevention
- Use headless=False or BrowserBase for bot-protected sites
- Allow render/wait time before snapshotting; retry once on empty renders
When it happens
Trigger: Scraping a fully JavaScript-rendered SPA whose content hasn't loaded when Chromium snapshots it; a page blocked by a bot check in headless mode; wrong URL that renders an empty shell.
Common situations: Default headless=True with anti-bot-protected sites; slow JS apps where content loads after the snapshot; incorrect wait/loading strategy.
Related errors
- Invalid input type: {input_type}
- PDF parsing exceeded timeout of {self.timeout} seconds
- pandas is not installed. Please install it using `pip instal
- No HTML body content found in the local source.
- No HTML body content found in the response.
AI-assisted analysis of ScrapeGraphAI/Scrapegraph-ai@532dfffbf6 (2026-08-28).
Data as JSON: /api/errors/f87619de239e7b8d.
Report an issue: GitHub.