{"record":{"id":"d3d010aa786566c1","repo":"ScrapeGraphAI/Scrapegraph-ai","slug":"model-not-supported","errorCode":null,"errorMessage":"Model not supported","messagePattern":"Model not supported","errorType":"validation","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"scrapegraphai/builders/graph_builder.py","lineNumber":81,"sourceCode":"        \"\"\"\n        llm_defaults = {\"temperature\": 0, \"streaming\": True}\n        llm_params = {**llm_defaults, **llm_config}\n        if \"api_key\" not in llm_params:\n            raise ValueError(\"LLM configuration must include an 'api_key'.\")\n\n        if \"gpt-\" in llm_params[\"model\"]:\n            return ChatOpenAI(llm_params)\n        elif \"gemini\" in llm_params[\"model\"]:\n            try:\n                from langchain_google_genai import ChatGoogleGenerativeAI\n            except ImportError:\n                raise ImportError(\n                    \"langchain_google_genai is not installed. Please install it using 'pip install langchain-google-genai'.\"\n                )\n            return ChatGoogleGenerativeAI(llm_params)\n        elif \"ernie\" in llm_params[\"model\"]:\n            return ErnieBotChat(llm_params)\n        raise ValueError(\"Model not supported\")\n\n    def _generate_nodes_description(self):\n        \"\"\"\n        Generates a string description of all available nodes and their arguments.\n\n        Returns:\n            str: A string description of all available nodes and their arguments.\n        \"\"\"\n\n        return \"\\n\".join(\n            [\n                f\"\"\"- {node}: {data[\"description\"]} (Type: {data[\"type\"]},\n            Args: {\", \".join(data[\"args\"].keys())})\"\"\"\n                for node, data in nodes_metadata.items()\n            ]\n        )\n\n    def _create_extraction_chain(self):","sourceCodeStart":63,"sourceCodeEnd":99,"githubUrl":"https://github.com/ScrapeGraphAI/Scrapegraph-ai/blob/532dfffbf6ee823a6c9cf8cfedc24a93bf026780/scrapegraphai/builders/graph_builder.py#L63-L99","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","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)."],"exampleFix":"# before\nconfig = {\"max_iterations\": {\"overall\": 3, \"current\": 3}}\n\n# after\nconfig = {\"max_iterations\": {\"overall\": 10, \"current\": 10}}","handlingStrategy":"retry","validationCode":"null","typeGuard":"null","tryCatchPattern":"try:\n    final_state = node.execute(state)\nexcept RuntimeError as e:\n    if \"Max iterations\" in str(e):\n        # inspect state['errors'], adjust prompt/model, retry with higher budget\n        ...","preventionTips":["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."],"tags":["code-generation","self-correction-loop","iterations","llm"],"backgroundTag":"max-iterations-exceeded","analyzedSha":"532dfffbf6ee823a6c9cf8cfedc24a93bf026780","analyzedAt":"2026-08-28T15:19:38.821Z","schemaVersion":2},"datasetVersion":"2026-08-28T16:17:29.566Z"}