ScrapeGraphAI/Scrapegraph-ai · error · ValueError
Model not supported
Error message
Model not supported
What it means
GenerateCodeNode's self-correcting loop ran for the configured max overall iterations while syntax, execution, validation, or semantic errors were still present in the generated code. The RuntimeError signals the LLM could not produce acceptable code within the correction budget, so the loop aborted instead of returning broken code.
Source
Thrown at scrapegraphai/builders/graph_builder.py:81
"""
llm_defaults = {"temperature": 0, "streaming": True}
llm_params = {**llm_defaults, **llm_config}
if "api_key" not in llm_params:
raise ValueError("LLM configuration must include an 'api_key'.")
if "gpt-" in llm_params["model"]:
return ChatOpenAI(llm_params)
elif "gemini" in llm_params["model"]:
try:
from langchain_google_genai import ChatGoogleGenerativeAI
except ImportError:
raise ImportError(
"langchain_google_genai is not installed. Please install it using 'pip install langchain-google-genai'."
)
return ChatGoogleGenerativeAI(llm_params)
elif "ernie" in llm_params["model"]:
return ErnieBotChat(llm_params)
raise ValueError("Model not supported")
def _generate_nodes_description(self):
"""
Generates a string description of all available nodes and their arguments.
Returns:
str: A string description of all available nodes and their arguments.
"""
return "\n".join(
[
f"""- {node}: {data["description"]} (Type: {data["type"]},
Args: {", ".join(data["args"].keys())})"""
for node, data in nodes_metadata.items()
]
)
def _create_extraction_chain(self):View on GitHub (pinned to 532dfffbf6)
Solutions
- Increase max_iterations['overall'] in the node/graph config so the correction loop gets more attempts.
- Switch to a stronger code-capable model (e.g. a top-tier LLM) for this node.
- Refine the input prompt/project context so the model has accurate library/API information.
- Inspect state['errors'] from the last iteration to see which check (syntax/execution/validation/semantic) keeps failing and address it directly (e.g. fix the target URL or provide example code).
Example fix
# before
config = {"max_iterations": {"overall": 3, "current": 3}}
# after
config = {"max_iterations": {"overall": 10, "current": 10}} Defensive patterns
Strategy: retry
Validate before calling
null
Type guard
null
Try / catch
try:
final_state = node.execute(state)
except RuntimeError as e:
if "Max iterations" in str(e):
# inspect state['errors'], adjust prompt/model, retry with higher budget
... Prevention
- Set max_iterations['overall'] generously for complex code-generation tasks.
- Use a strong code-capable model for code generation nodes.
- Log the last iteration's state['errors'] to identify which check never converges.
When it happens
Trigger: Calling execute() on GenerateCodeNode with max_iterations['overall'] too low for hard tasks, a weak model that repeatedly fails the syntax/execution/validation/semantic checks, or prompts/library APIs the model keeps misusing so errors never converge to zero.
Common situations: Using a small local model for code generation; targeting a website whose scraping code keeps failing at runtime (selectors, anti-bot); raising task complexity without raising the iteration budget; outdated model knowledge producing deprecated library calls that fail execution checks.
Related errors
- Semantic code generation failed: {str(e)}
- model_tokens not specified
- Provider {llm_params["model_provider"]} is not supported.
- Provider {llm_params["model_provider"]} is not supported.
- The langchain_together module is not installed.
AI-assisted analysis of ScrapeGraphAI/Scrapegraph-ai@532dfffbf6 (2026-08-28).
Data as JSON: /api/errors/d3d010aa786566c1.
Report an issue: GitHub.