{"record":{"id":"95cb23954944db03","repo":"crewAIInc/crewAI","slug":"unsupported-output-format-output-format-must-b","errorCode":null,"errorMessage":"Unsupported output format: {output_format}. Must be one of {', '.join(valid_output_formats)}.","messagePattern":"Unsupported output format: (.+?)\\. Must be one of (.+?)\\.","errorType":"exception","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"lib/crewai-tools/src/crewai_tools/tools/brightdata_tool/brightdata_dataset.py","lineNumber":574,"sourceCode":"        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,\n                    additional_params=additional_params,\n                )\n            )\n        except TimeoutError as e:","sourceCodeStart":556,"sourceCodeEnd":592,"githubUrl":"https://github.com/crewAIInc/crewAI/blob/754d7323beb2fd042e33444a115ea2d5a47193f0/lib/crewai-tools/src/crewai_tools/tools/brightdata_tool/brightdata_dataset.py#L556-L592","documentation":"Raised in BrightDataDatasetTool._run when output_format (the `format` argument, falling back to self.format) is not one of {'json','ndjson','jsonl','csv'}. The value is forwarded verbatim as the format query param to the snapshot download endpoint, so unsupported values are rejected up front.","triggerScenarios":"Calling tool.run(..., format='md') or format='xlsx'; passing format=None when the constructor also had no format (None is not in the valid set); typo like 'JSON' with uppercase letters.","commonSituations":"Confusing this tool's format (API serialization) with the unlocker tool's data_format ('html'/'markdown'), case-sensitivity mistakes, no default format set in some versions.","solutions":["Use exactly one of: json, ndjson, jsonl, csv (lowercase).","Set a default in the constructor: BrightDataDatasetTool(..., format='json') so per-call omission is safe.","If you wanted markdown/html page content, use BrightDataUnlockerTool instead of the dataset tool."],"exampleFix":"# before\ntool.run(url=url, dataset_type='amazon_product', format='xlsx')\n\n# after\ntool.run(url=url, dataset_type='amazon_product', format='json')","handlingStrategy":"validation","validationCode":"VALID_DATASET_FORMATS = {\"json\", \"ndjson\", \"jsonl\", \"csv\"}\n\noutput_format = (format or 'json').lower()\nif output_format not in VALID_DATASET_FORMATS:\n    raise ValueError(f\"format must be one of {VALID_DATASET_FORMATS}\")\nresult = tool.run(url=url, dataset_type=dt, format=output_format)","typeGuard":"def is_valid_dataset_format(v: object) -> bool:\n    return isinstance(v, str) and v in {\"json\", \"ndjson\", \"jsonl\", \"csv\"}","tryCatchPattern":"try:\n    result = tool.run(url=url, dataset_type=dt, format=format)\nexcept ValueError as e:\n    if \"Unsupported output format\" in str(e):\n        result = tool.run(url=url, dataset_type=dt, format='json')\n    else:\n        raise","preventionTips":["Whitelist and lowercase user/agent-supplied format values before the call.","Set format='json' as the constructor default.","Use the unlocker tool (data_format html/markdown) when you want page content, not dataset exports."],"tags":["bright-data","validation","format","dataset"],"backgroundTag":null,"analyzedSha":"754d7323beb2fd042e33444a115ea2d5a47193f0","analyzedAt":"2026-08-15T04:06:56.746Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}