crewAIInc/crewAI · error · ValueError
Unable to find the dataset for {dataset_type}. Please make s
Error message
Unable to find the dataset for {dataset_type}. Please make sure to pass a valid one What it means
Raised by BrightDataDatasetTool when filter_dataset_by_id(dataset_type) does not return exactly one matching dataset entry. The tool keeps an internal registry of dataset types (e.g. 'amazon_product', 'maps'), and only the unambiguous single-match case proceeds; zero matches (or an ambiguous multi-match) raises this error.
Source
Thrown at lib/crewai-tools/src/crewai_tools/tools/brightdata_tool/brightdata_dataset.py:494
# Set additional parameters dynamically depending upon the dataset that is being requested
if additional_params:
request_data.update(additional_params)
api_key = os.getenv("BRIGHT_DATA_API_KEY")
headers = {
"Authorization": f"Bearer {api_key}",
"Content-Type": "application/json",
}
dataset_id = ""
dataset = self.filter_dataset_by_id(dataset_type)
if len(dataset) == 1:
dataset_id = dataset[0]["dataset_id"]
else:
raise ValueError(
f"Unable to find the dataset for {dataset_type}. Please make sure to pass a valid one"
)
async with aiohttp.ClientSession() as session:
async with session.post(
f"{BRIGHTDATA_API_URL}/datasets/v3/trigger",
params={"dataset_id": dataset_id, "include_errors": "true"},
json=[request_data],
headers=headers,
) as trigger_response:
if trigger_response.status != 200:
raise BrightDataDatasetToolException(
f"Trigger failed: {await trigger_response.text()}",
trigger_response.status,
)
trigger_data = await trigger_response.json()
snapshot_id = trigger_data.get("snapshot_id")
View on GitHub (pinned to 754d7323be)
Solutions
- Inspect the tool's dataset registry (the DATASET/filter mapping near filter_dataset_by_id) and use an exact supported dataset_type value.
- Print the available types: most Bright Data tool builds expose the mapping as a module-level constant.
- Pass dataset_type explicitly in the constructor or _run call instead of relying on defaults.
Example fix
# before tool.run(url='https://www.amazon.com/dp/B0...', dataset_type='amazon_prod') # after tool.run(url='https://www.amazon.com/dp/B0...', dataset_type='amazon_product')
Defensive patterns
Strategy: validation
Validate before calling
from crewai_tools.tools.brightdata_tool.brightdata_dataset import BrightDataDatasetTool
tool = BrightDataDatasetTool()
valid = {d["dataset_id"]: d for d in []} # placeholder; enumerate registry:
# derive the accepted set from the tool's own filter
accepted = {t for t in tool._DATASET_REGISTRY} if hasattr(tool, "_DATASET_REGISTRY") else None
assert dataset_type in accepted, f"use one of {accepted}" Try / catch
try:
result = tool.run(url=url, dataset_type=dataset_type)
except ValueError as e:
if "Unable to find the dataset" in str(e):
dataset_type = prompt_user_or_default_dataset()
result = tool.run(url=url, dataset_type=dataset_type)
else:
raise Prevention
- Pin dataset_type to values copied from the tool's registry, not guessed names.
- Wrap dataset_type in a config constant to avoid drift across call sites.
- Add a unit test asserting your configured dataset_type resolves via filter_dataset_by_id.
When it happens
Trigger: Calling the tool with dataset_type='unknown_api' or a typo like 'amazon_prod'; passing a dataset_type string that doesn't match any key in the tool's dataset registry before the Bright Data trigger POST.
Common situations: Guessing dataset type names instead of reading the tool's supported list, casing/underscore mismatches ('amazon-product' vs 'amazon_product'), version drift where a dataset id was renamed in the registry.
Related errors
- dataset_type is required either in constructor or method cal
- Unsupported output format: {output_format}. Must be one of {
- Project name cannot be empty
- Project name '{name}' produces invalid folder name '{folder_
- No deployable project files were found.
AI-assisted analysis of crewAIInc/crewAI@754d7323be (2026-08-15).
Data as JSON: /api/errors/1209604792ec8cf9.
Report an issue: GitHub.