ScrapeGraphAI/Scrapegraph-ai · error · ImportError
The 'graphviz' library is required for this functionality. P
Error message
The 'graphviz' library is required for this functionality. Please install it from 'https://graphviz.org/download/'.
What it means
GraphIteratorNode raises this ValueError in its async execution path when node_config has no 'graph_instance'. The node fans out one graph instance per URL for concurrent scraping, so it must be told which graph class to clone; without it there is nothing to execute.
Source
Thrown at scrapegraphai/builders/graph_builder.py:150
dict: A JSON representation of the graph configuration.
"""
return self.chain.invoke(self.prompt)
@staticmethod
def convert_json_to_graphviz(json_data, format: str = "pdf"):
"""
Converts a JSON graph configuration to a Graphviz object for visualization.
Args:
json_data (dict): A JSON representation of the graph configuration.
Returns:
graphviz.Digraph: A Graphviz object representing the graph configuration.
"""
try:
import graphviz
except ImportError:
raise ImportError(
"The 'graphviz' library is required for this functionality. "
"Please install it from 'https://graphviz.org/download/'."
)
graph = graphviz.Digraph(
comment="ScrapeGraphAI Generated Graph",
format=format,
node_attr={"color": "lightblue2", "style": "filled"},
)
graph_config = json_data["text"][0]
# Retrieve nodes, edges, and the entry point from the JSON data
nodes = graph_config.get("nodes", [])
edges = graph_config.get("edges", [])
entry_point = graph_config.get("entry_point")
for node in nodes:View on GitHub (pinned to 532dfffbf6)
Solutions
- Provide the graph class under node_config['graph_instance'] (e.g. a lambda/class reference like SmartScraperGraph).
- Also pass 'scraper_config' with the LLM/embeddings config so the cloned graphs are fully configured.
- Check the examples/ folder for the specific iterator graph to confirm the expected config shape.
Example fix
# before
node_config = {"scraper_config": scraper_config}
# after
from scrapegraphai.graphs import SmartScraperGraph
node_config = {
"graph_instance": SmartScraperGraph,
"scraper_config": scraper_config,
} Defensive patterns
Strategy: validation
Validate before calling
if not node_config.get("graph_instance"):
raise ValueError("node_config['graph_instance'] must be the graph class to fan out") Type guard
def has_graph_instance(node_config: dict) -> bool:
return callable(node_config.get("graph_instance")) Try / catch
try:
result = iterator_graph.run()
except ValueError as e:
if "graph instance is required" in str(e):
# add graph_instance to node_config and retry
... Prevention
- Always pair GraphIteratorNode with both 'graph_instance' and 'scraper_config' in node_config.
- Copy config shapes from the official examples/ folder for iterator-based graphs.
When it happens
Trigger: Configuring GraphIteratorNode without node_config['graph_instance'], passing None explicitly, or passing an instance instead of the class (though the None check here fires only when the key is missing/None).
Common situations: Copy-pasting a SmartScraperGraph config into a ScriptScraperMultisourceGraph or similar iterator-based graph and dropping the graph_instance entry; assuming the node reuses the parent graph automatically.
Related errors
- LLM configuration must include an 'api_key'.
- langchain_google_genai is not installed. Please install it u
- The browserbase module is not installed. Please install it u
- Cannot deep copy object of type {type(obj)}
- Unsupported service tier {service_tier!r} for {model_name}
AI-assisted analysis of ScrapeGraphAI/Scrapegraph-ai@532dfffbf6 (2026-08-28).
Data as JSON: /api/errors/fc7f1d9dbecc7e03.
Report an issue: GitHub.