Skip to content

Param reattempt on config error #986

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
LordDangerous opened this issue Jun 13, 2025 · 1 comment
Open

Param reattempt on config error #986

LordDangerous opened this issue Jun 13, 2025 · 1 comment
Labels
bug Something isn't working

Comments

@LordDangerous
Copy link

Error when using reattempt parameter on config.

To Reproduce
Steps to reproduce the behavior:
graph_config = {
"llm": {
"model_instance": llm_model_instance,
"model_tokens": 128000,
},
"verbose": True,
"headless": True,
"reattempt": True
}
smart_scraper_graph = SmartScraperGraph(
prompt=prompt,
config=graph_config,
schema=None,
source="https://perinim.github.io/"
)
result = smart_scraper_graph.run()

Traceback (most recent call last):
File "C:\Users\malsina\Documents\projects\sql_crew.venv\Lib\site-packages\scrapegraphai\graphs\base_graph.py", line 117, in _set_conditional_node_edges
node.false_node_name = outgoing_edges[1][1].node_name
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
AttributeError: 'NoneType' object has no attribute 'node_name'

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
File "C:\Users\malsina\Documents\projects\sql_crew\test_web_scraping.py", line 59, in
smart_scraper_graph = SmartScraperGraph(
^^^^^^^^^^^^^^^^^^
File "C:\Users\malsina\Documents\projects\sql_crew.venv\Lib\site-packages\scrapegraphai\graphs\smart_scraper_graph.py", line 61, in init
super().init(prompt, config, source, schema)
File "C:\Users\malsina\Documents\projects\sql_crew.venv\Lib\site-packages\scrapegraphai\graphs\abstract_graph.py", line 76, in init
self.graph = self._create_graph()
^^^^^^^^^^^^^^^^^^^^
File "C:\Users\malsina\Documents\projects\sql_crew.venv\Lib\site-packages\scrapegraphai\graphs\smart_scraper_graph.py", line 274, in _create_graph
return BaseGraph(
^^^^^^^^^^
File "C:\Users\malsina\Documents\projects\sql_crew.venv\Lib\site-packages\scrapegraphai\graphs\base_graph.py", line 78, in init
self._set_conditional_node_edges()
File "C:\Users\malsina\Documents\projects\sql_crew.venv\Lib\site-packages\scrapegraphai\graphs\base_graph.py", line 122, in _set_conditional_node_edges
raise ValueError(
ValueError: Failed to set false_node_name for ConditionalNode 'ConditionalNode'

I saw this implemented here: eaa83ed

Am i missing something?
Thanks!

Copy link

dosubot bot commented Jun 13, 2025

Hi @LordDangerous! I'm Dosu and I’m helping the Scrapegraph-ai team.

The error happens because, when 'reattempt' is set to True, the graph configuration creates a ConditionalNode with one of its outgoing edges pointing to None (to represent a terminal/exit branch). However, the core graph logic expects both outgoing edges from a ConditionalNode to point to real nodes, and tries to access node_name on both. This causes the AttributeError you’re seeing, and then a ValueError is raised when the false_node_name can't be set properly see code details and graph config.

This design was introduced in the PR you referenced, but it’s not compatible with the current node/graph contract. To work around this, you’d need to ensure that both outgoing edges from the ConditionalNode point to actual nodes. One common pattern is to add a dummy terminal node (like a NoOp or End node) instead of None.

Until the library is updated to handle None as a valid terminal, you’ll hit this error with 'reattempt': True. You can track for updates or consider patching locally by adding a dummy node in place of None in your graph config.

Docs do mention 'reattempt' as a feature example, but the current implementation has this incompatibility.

To reply, just mention @dosu.


How did I do? Good | Irrelevant | Incorrect | Verbose | Hallucination | Report 🐛 | Other  Join Discord Share on X

@dosubot dosubot bot added the bug Something isn't working label Jun 13, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant