{"record":{"id":"5864171b2b8d9533","repo":"crewAIInc/crewAI","slug":"website-url-is-required","errorCode":null,"errorMessage":"website_url is required","messagePattern":"website_url is required","errorType":"validation","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"lib/crewai-tools/src/crewai_tools/tools/scrapegraph_scrape_tool/scrapegraph_scrape_tool.py","lineNumber":170,"sourceCode":"            raise RuntimeError(f\"API error: {error_msg}\")\n\n        if \"result\" not in response:\n            raise RuntimeError(\"Invalid response format from Scrapegraph API\")\n\n        return str(response[\"result\"])\n\n    def _run(\n        self,\n        **kwargs: Any,\n    ) -> Any:\n        website_url = kwargs.get(\"website_url\", self.website_url)\n        user_prompt = (\n            kwargs.get(\"user_prompt\", self.user_prompt)\n            or \"Extract the main content of the webpage\"\n        )\n\n        if not website_url:\n            raise ValueError(\"website_url is required\")\n\n        self._validate_url(website_url)\n\n        try:\n            if self._client is None:\n                raise RuntimeError(\"Client not initialized\")\n            return self._client.smartscraper(\n                website_url=website_url,\n                user_prompt=user_prompt,\n            )\n\n        except RateLimitError:\n            raise  # Re-raise rate limit errors\n        except Exception as e:\n            raise RuntimeError(f\"Scraping failed: {e!s}\") from e\n        finally:\n            # Always close the client\n            if self._client is not None:","sourceCodeStart":152,"sourceCodeEnd":188,"githubUrl":"https://github.com/crewAIInc/crewAI/blob/754d7323beb2fd042e33444a115ea2d5a47193f0/lib/crewai-tools/src/crewai_tools/tools/scrapegraph_scrape_tool/scrapegraph_scrape_tool.py#L152-L188","documentation":"Raised as ValueError by ScrapegraphScrapeTool._run when website_url resolves to a falsy value after checking both the _run kwargs and the tool instance attribute. The tool accepts the URL either as a constructor argument (website_url=...) or per-call kwarg; if neither is supplied, scraping cannot proceed. This is a pure usage error — the API is never contacted.","triggerScenarios":"Instantiating ScrapegraphScrapeTool() with no website_url and calling _run(**kwargs) without a website_url kwarg; or explicitly passing website_url=None on both the constructor and the call.","commonSituations":"Building the tool dynamically (e.g. from config) where the URL field is optional and forgotten; passing the URL under a different kwarg name (typo like 'url' or 'web_url'); a template that constructs tools without arguments intending to pass URLs at run time but the agent omits the parameter.","solutions":["Pass website_url to the constructor: ScrapegraphScrapeTool(website_url='https://example.com', ...).","Or pass it per call in the kwargs: tool.run(website_url='https://example.com').","Check for typos in the kwarg name — only 'website_url' is read via kwargs.get."],"exampleFix":"# before\ntool = ScrapegraphScrapeTool(api_key=KEY)\ntool.run()  # ValueError: website_url is required\n\n# after\ntool = ScrapegraphScrapeTool(api_key=KEY)\ntool.run(website_url=\"https://example.com\")","handlingStrategy":"validation","validationCode":"def ensure_url(url: str | None) -> str:\n    if not url or not url.strip():\n        raise ValueError(\"website_url is required\")\n    return url.strip()\n\nurl = ensure_url(maybe_url)\nresult = tool.run(website_url=url)","typeGuard":null,"tryCatchPattern":"try:\n    result = tool.run(website_url=url)\nexcept ValueError as e:\n    if \"website_url is required\" in str(e):\n        url = prompt_or_default_url()  # recover\n        result = tool.run(website_url=url)\n    raise","preventionTips":["Always pass website_url — at construction or per call — never both empty.","Exact kwarg name 'website_url'; other names are silently ignored by kwargs.get.","Assert required URL config before building crews so failures happen at startup, not mid-run."],"tags":["validation","usage-error","scrapegraph","required-argument"],"backgroundTag":null,"analyzedSha":"754d7323beb2fd042e33444a115ea2d5a47193f0","analyzedAt":"2026-08-15T04:06:56.746Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}