ScrapeGraphAI/Scrapegraph-ai · error · ValueError
Failed to set false_node_name for ConditionalNode '{node.nod
Error message
Failed to set false_node_name for ConditionalNode '{node.node_name}' What it means
Companion check in _set_conditional_node_edges: after confirming two outgoing edges exist, reading outgoing_edges[1][1].node_name failed with IndexError or AttributeError. In practice this fires when the second edge's to_node is None or an object without a node_name attribute (e.g. a malformed tuple in the edges list).
Source
Thrown at scrapegraphai/graphs/base_graph.py:122
for node in self.nodes:
if node.node_type == "conditional_node":
outgoing_edges = [
(from_node, to_node)
for from_node, to_node in self.raw_edges
if from_node.node_name == node.node_name
]
if len(outgoing_edges) != 2:
raise ValueError(
f"ConditionalNode '{node.node_name}' must have exactly two outgoing edges."
)
node.true_node_name = outgoing_edges[0][1].node_name
try:
node.false_node_name = outgoing_edges[1][1].node_name
except (IndexError, AttributeError) as e:
# IndexError: If outgoing_edges[1] doesn't exist
# AttributeError: If to_node is None or doesn't have node_name
node.false_node_name = None
raise ValueError(
f"Failed to set false_node_name for ConditionalNode '{node.node_name}'"
) from e
def _get_node_by_name(self, node_name: str):
"""Returns a node instance by its name."""
return next(node for node in self.nodes if node.node_name == node_name)
def _update_source_info(self, current_node, state):
"""Updates source type and source information from FetchNode."""
source_type = None
source = []
prompt = None
if current_node.__class__.__name__ == "FetchNode":
source_type = list(state.keys())[1]
if state.get("user_prompt", None):
prompt = (
state["user_prompt"]View on GitHub (pinned to 532dfffbf6)
Solutions
- Inspect the raw_edges/edges list and make sure every tuple's second element is a fully constructed BaseNode with a node_name.
- Fix the code that produced a None destination (usually a node-lookup miss) so it returns the real node instance.
- Add an assertion when building edges: assert to_node is not None and hasattr(to_node, 'node_name').
Example fix
# before
edges = [(cond, node_a), (cond, nodes_by_name.get('missing'))]
# after
edges = [(cond, node_a), (cond, nodes_by_name['fallback_node'])] Defensive patterns
Strategy: validation
Validate before calling
for f, t in edges:
assert t is not None and hasattr(t, 'node_name'), f'malformed edge destination: {t!r}' Type guard
def edges_well_formed(edges) -> bool:
return all(t is not None and hasattr(t, 'node_name') for _, t in edges) Try / catch
try:
g = BaseGraph(nodes=nodes, edges=edges, entry_point=entry)
except ValueError as e:
if 'false_node_name' in str(e):
# inspect edges for None/malformed second destination, fix, retry
raise
raise Prevention
- Type edge tuples as Tuple[BaseNode, BaseNode] and construct them only from real instances.
- Fail fast on None when looking up nodes by name.
- Add a topology sanity check in tests for custom graphs.
When it happens
Trigger: Passing an edge tuple whose destination is None ([(cond, real_node), (cond, None)]) or a non-node object (string, dict) in the second position; a node whose node_name attribute was deleted or never set.
Common situations: Programmatically building edge lists where a lookup of a node by name returned None; typos when constructing tuples; partially initialized node objects in test fixtures.
Related errors
- ConditionalNode '{node.node_name}' must have exactly two out
- Conditional Node returned a node name '{result}' that does n
- Node with name '{node.node_name}' already exists in the grap
- You need to provide key_name inside the node config
- ConditionalNode's next nodes are not set properly.
AI-assisted analysis of ScrapeGraphAI/Scrapegraph-ai@532dfffbf6 (2026-08-28).
Data as JSON: /api/errors/c5efcddcaa46d409.
Report an issue: GitHub.