crewAIInc/crewAI · error · BrightDataDatasetToolException
Result fetch failed: {await snapshot_response.text()}
Error message
Result fetch failed: {await snapshot_response.text()} What it means
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.
Source
Thrown at lib/crewai-tools/src/crewai_tools/tools/brightdata_tool/brightdata_dataset.py:543
status_response.status,
)
status_data = await status_response.json()
if status_data.get("status") == "ready":
break
if status_data.get("status") == "error":
raise BrightDataDatasetToolException(
f"Job failed: {status_data}", 0
)
else:
raise TimeoutError("Polling timed out before job completed.")
async with session.get(
f"{BRIGHTDATA_API_URL}/datasets/v3/snapshot/{snapshot_id}",
params={"format": output_format},
headers=headers,
) as snapshot_response:
if snapshot_response.status != 200:
raise BrightDataDatasetToolException(
f"Result fetch failed: {await snapshot_response.text()}",
snapshot_response.status,
)
return await snapshot_response.text()
def _run(
self,
url: str | None = None,
dataset_type: str | None = None,
format: str | None = None,
zipcode: str | None = None,
additional_params: dict[str, Any] | None = None,
**kwargs: Any,
) -> Any:
dataset_type = dataset_type or self.dataset_type
output_format = format or self.format
url = url or self.urlView on GitHub (pinned to 754d7323be)
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.
Example fix
# before tool.run(url=url, dataset_type='maps', format='csv') # unsupported # after tool.run(url=url, dataset_type='maps', format='json')
Defensive patterns
Strategy: fallback
Validate before calling
VALID_FORMATS = {"json", "ndjson", "jsonl", "csv"}
if output_format not in VALID_FORMATS:
output_format = "json" # safest universal default
tool.run(url=url, dataset_type=dataset_type, format=output_format) Try / catch
try:
result = tool.run(url=url, dataset_type=dataset_type, format='csv')
except BrightDataDatasetToolException as e:
if e.status_code == 400 and 'format' in str(e):
result = tool.run(url=url, dataset_type=dataset_type, format='json')
else:
raise Prevention
- 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.
When it happens
Trigger: 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.
Common situations: Long gaps between job completion and result fetch (retention expiry), format mismatches, credential rotation mid-workflow.
Related errors
- Status check failed: {await status_response.text()}
- Trigger failed: {await trigger_response.text()}
- Unsupported output format: {output_format}. Must be one of {
- Unsupported data format: {data_format}. Must be one of {', '
- Project name '{name}' would generate invalid Python class na
AI-assisted analysis of crewAIInc/crewAI@754d7323be (2026-08-15).
Data as JSON: /api/errors/efc57c80ec938669.
Report an issue: GitHub.