FoundationAgents/MetaGPT · error · ValueError
Dataset {task_name} not found in config file. Available data
Error message
Dataset {task_name} not found in config file. Available datasets: {config['datasets'].keys()} What it means
Raised by get_user_requirement when task_name is not a key in config['datasets']. It looks up the dataset's 'user_requirement' text to build the natural-language prompt for the experiment, so an unregistered task cannot produce a requirement.
Source
Thrown at metagpt/ext/sela/data/dataset.py:141
"test_wo_target": os.path.join(data_path, "split_test_wo_target.csv"),
"test_target": os.path.join(data_path, "split_test_target.csv"),
}
return split_datasets
else:
raise ValueError(
f"Dataset {dataset_name} not found in config file. Available datasets: {config['datasets'].keys()}"
)
def get_user_requirement(task_name, config):
# datasets_dir = config["datasets_dir"]
if task_name in config["datasets"]:
dataset = config["datasets"][task_name]
# data_path = os.path.join(datasets_dir, dataset["dataset"])
user_requirement = dataset["user_requirement"]
return user_requirement
else:
raise ValueError(
f"Dataset {task_name} not found in config file. Available datasets: {config['datasets'].keys()}"
)
def save_datasets_dict_to_yaml(datasets_dict, name="datasets.yaml"):
with open(name, "w") as file:
yaml.dump(datasets_dict, file)
def create_dataset_dict(dataset):
dataset_dict = {
"dataset": dataset.name,
"user_requirement": dataset.create_base_requirement(),
"metric": dataset.get_metric(),
"target_col": dataset.target_col,
}
return dataset_dict
View on GitHub (pinned to 11cdf466d0)
Solutions
- Add a 'user_requirement' (and full entry) for the task in the datasets config
- Use a task name that appears in the 'Available datasets' list from the error
- Verify the config object passed is the intended datasets.yaml (paths can differ per working directory)
Defensive patterns
Strategy: validation
Validate before calling
assert task_name in config["datasets"], f"{task_name} not registered" Type guard
def is_registered_task(task_name: str, config: dict) -> bool:
return task_name in config.get("datasets", {}) Prevention
- Validate task names against the yaml at startup
- Keep a single source of truth for task names
When it happens
Trigger: Calling get_user_requirement(task_name, config) with a task that has no entry in datasets.yaml, e.g. launching an experiment with --task <name> before adding that dataset.
Common situations: New/custom dataset added to the data directory but not to the yaml; task name typo; running SELA tasks from a config file of a different version.
Related errors
- Dataset {dataset_name} not found in config file. Available d
- Target column not provided
- Number of classes {num_classes} not supported
- Invalid exp_mode: {args.exp_mode}
- Dataset {task_name} not found in config file. Available data
AI-assisted analysis of FoundationAgents/MetaGPT@11cdf466d0 (2026-08-14).
Data as JSON: /api/errors/35697187100570d0.
Report an issue: GitHub.