{"record":{"id":"aba29f87b72438f8","repo":"crewAIInc/crewAI","slug":"url-is-required-either-in-constructor-or-method-ca","errorCode":null,"errorMessage":"url is required either in constructor or method call","messagePattern":"url is required either in constructor or method call","errorType":"exception","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"lib/crewai-tools/src/crewai_tools/tools/brightdata_tool/brightdata_dataset.py","lineNumber":570,"sourceCode":"        url: str | None = None,\n        dataset_type: str | None = None,\n        format: str | None = None,\n        zipcode: str | None = None,\n        additional_params: dict[str, Any] | None = None,\n        **kwargs: Any,\n    ) -> Any:\n        dataset_type = dataset_type or self.dataset_type\n        output_format = format or self.format\n        url = url or self.url\n        zipcode = zipcode or self.zipcode\n        additional_params = additional_params or self.additional_params\n\n        if not dataset_type:\n            raise ValueError(\n                \"dataset_type is required either in constructor or method call\"\n            )\n        if not url:\n            raise ValueError(\"url is required either in constructor or method call\")\n\n        valid_output_formats = {\"json\", \"ndjson\", \"jsonl\", \"csv\"}\n        if output_format not in valid_output_formats:\n            raise ValueError(\n                f\"Unsupported output format: {output_format}. Must be one of {', '.join(valid_output_formats)}.\"\n            )\n\n        api_key = os.getenv(\"BRIGHT_DATA_API_KEY\")\n        if not api_key:\n            raise ValueError(\"BRIGHT_DATA_API_KEY environment variable is required.\")\n\n        try:\n            return asyncio.run(\n                self.get_dataset_data_async(\n                    dataset_type=dataset_type,\n                    output_format=output_format,\n                    url=url,\n                    zipcode=zipcode,","sourceCodeStart":552,"sourceCodeEnd":588,"githubUrl":"https://github.com/crewAIInc/crewAI/blob/754d7323beb2fd042e33444a115ea2d5a47193f0/lib/crewai-tools/src/crewai_tools/tools/brightdata_tool/brightdata_dataset.py#L552-L588","documentation":"Raised in BrightDataDatasetTool._run when the url parameter resolves to falsy both at call-site level and constructor level (url = url or self.url). The Bright Data dataset API is URL-driven — it tells the dataset which page to scrape — so a missing URL is rejected before validation of anything else downstream.","triggerScenarios":"Calling tool.run(dataset_type='amazon_product') with no url anywhere; passing url='' or url=None explicitly; constructor built with only dataset_type and format.","commonSituations":"Assuming dataset_type alone triggers a discovery job (it does not — this tool always needs a target URL), agents dropping the url argument, config templates that leave url blank.","solutions":["Pass the target page URL: tool.run(url='https://www.amazon.com/dp/B0XXXX', dataset_type='amazon_product').","Or set it once in the constructor: BrightDataDatasetTool(dataset_type='amazon_product', url=product_url).","Ensure the URL is a fully qualified http(s) URL string, not empty."],"exampleFix":"# before\nresult = tool.run(dataset_type='amazon_product')\n\n# after\nresult = tool.run(dataset_type='amazon_product', url='https://www.amazon.com/dp/B0XXXX')","handlingStrategy":"validation","validationCode":"def validate_target_url(url: str | None) -> str:\n    if not url or not url.startswith((\"http://\", \"https://\")):\n        raise ValueError(\"A fully qualified http(s) URL is required for Bright Data datasets\")\n    return url\n\nurl = validate_target_url(url or tool.url)\nresult = tool.run(url=url, dataset_type='amazon_product')","typeGuard":"def is_runnable_dataset_call(kwargs: dict, tool) -> bool:\n    return bool((kwargs.get(\"url\") or tool.url) and (kwargs.get(\"dataset_type\") or tool.dataset_type))","tryCatchPattern":"try:\n    result = tool.run(dataset_type='amazon_product')\nexcept ValueError as e:\n    if \"url is required\" in str(e):\n        result = tool.run(dataset_type='amazon_product', url=get_url_from_task())\n    else:\n        raise","preventionTips":["Bind the URL in the constructor when the tool targets one known page.","For per-call URLs, validate them in your pipeline before tool dispatch.","Remember the dataset tool is always URL-driven — there is no discovery mode."],"tags":["bright-data","validation","required-parameter","url"],"backgroundTag":null,"analyzedSha":"754d7323beb2fd042e33444a115ea2d5a47193f0","analyzedAt":"2026-08-15T04:06:56.746Z","schemaVersion":2},"datasetVersion":"2026-08-15T17:31:12.345Z"}