{"record":{"id":"efc57c80ec938669","repo":"crewAIInc/crewAI","slug":"result-fetch-failed-await-snapshot-response-text","errorCode":null,"errorMessage":"Result fetch failed: {await snapshot_response.text()}","messagePattern":"Result fetch failed: (.+?)","errorType":"http","errorClass":"BrightDataDatasetToolException","httpStatus":null,"severity":"error","filePath":"lib/crewai-tools/src/crewai_tools/tools/brightdata_tool/brightdata_dataset.py","lineNumber":543,"sourceCode":"                            status_response.status,\n                        )\n                    status_data = await status_response.json()\n                    if status_data.get(\"status\") == \"ready\":\n                        break\n                    if status_data.get(\"status\") == \"error\":\n                        raise BrightDataDatasetToolException(\n                            f\"Job failed: {status_data}\", 0\n                        )\n            else:\n                raise TimeoutError(\"Polling timed out before job completed.\")\n\n            async with session.get(\n                f\"{BRIGHTDATA_API_URL}/datasets/v3/snapshot/{snapshot_id}\",\n                params={\"format\": output_format},\n                headers=headers,\n            ) as snapshot_response:\n                if snapshot_response.status != 200:\n                    raise BrightDataDatasetToolException(\n                        f\"Result fetch failed: {await snapshot_response.text()}\",\n                        snapshot_response.status,\n                    )\n\n                return await snapshot_response.text()\n\n    def _run(\n        self,\n        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","sourceCodeStart":525,"sourceCodeEnd":561,"githubUrl":"https://github.com/crewAIInc/crewAI/blob/754d7323beb2fd042e33444a115ea2d5a47193f0/lib/crewai-tools/src/crewai_tools/tools/brightdata_tool/brightdata_dataset.py#L525-L561","documentation":"A BrightDataDatasetToolException raised when the final GET /datasets/v3/snapshot/{snapshot_id} (with format=output_format) returns non-200. The job reached 'ready', but downloading the result failed — common causes are an unsupported format for that dataset, an expired/purged snapshot, or auth issues.","triggerScenarios":"Requesting format='csv' for a dataset that only exposes json, fetching a snapshot after Bright Data purged it (results have limited retention), or an invalidated API key at fetch time.","commonSituations":"Long gaps between job completion and result fetch (retention expiry), format mismatches, credential rotation mid-workflow.","solutions":["Read the embedded response text; format errors state the allowed values for that dataset.","Retry with format='json' (the most universally supported output format).","Fetch results promptly after job completion; if purged, re-trigger the job.","Confirm BRIGHT_DATA_API_KEY is still valid."],"exampleFix":"# before\ntool.run(url=url, dataset_type='maps', format='csv')  # unsupported\n\n# after\ntool.run(url=url, dataset_type='maps', format='json')","handlingStrategy":"fallback","validationCode":"VALID_FORMATS = {\"json\", \"ndjson\", \"jsonl\", \"csv\"}\n\nif output_format not in VALID_FORMATS:\n    output_format = \"json\"  # safest universal default\ntool.run(url=url, dataset_type=dataset_type, format=output_format)","typeGuard":null,"tryCatchPattern":"try:\n    result = tool.run(url=url, dataset_type=dataset_type, format='csv')\nexcept BrightDataDatasetToolException as e:\n    if e.status_code == 400 and 'format' in str(e):\n        result = tool.run(url=url, dataset_type=dataset_type, format='json')\n    else:\n        raise","preventionTips":["Default to format='json' unless you know the dataset supports csv/ndjson.","Fetch snapshot results immediately after completion — they expire.","Map each dataset_type you use to its supported formats in your own config."],"tags":["bright-data","http","snapshot","format"],"backgroundTag":null,"analyzedSha":"754d7323beb2fd042e33444a115ea2d5a47193f0","analyzedAt":"2026-08-15T04:06:56.746Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}