{"record":{"id":"35697187100570d0","repo":"FoundationAgents/MetaGPT","slug":"dataset-task-name-not-found-in-config-file-avai","errorCode":null,"errorMessage":"Dataset {task_name} not found in config file. Available datasets: {config['datasets'].keys()}","messagePattern":"Dataset (.+?) not found in config file\\. Available datasets: (.+?)","errorType":"validation","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"metagpt/ext/sela/data/dataset.py","lineNumber":141,"sourceCode":"            \"test_wo_target\": os.path.join(data_path, \"split_test_wo_target.csv\"),\n            \"test_target\": os.path.join(data_path, \"split_test_target.csv\"),\n        }\n        return split_datasets\n    else:\n        raise ValueError(\n            f\"Dataset {dataset_name} not found in config file. Available datasets: {config['datasets'].keys()}\"\n        )\n\n\ndef get_user_requirement(task_name, config):\n    # datasets_dir = config[\"datasets_dir\"]\n    if task_name in config[\"datasets\"]:\n        dataset = config[\"datasets\"][task_name]\n        # data_path = os.path.join(datasets_dir, dataset[\"dataset\"])\n        user_requirement = dataset[\"user_requirement\"]\n        return user_requirement\n    else:\n        raise ValueError(\n            f\"Dataset {task_name} not found in config file. Available datasets: {config['datasets'].keys()}\"\n        )\n\n\ndef save_datasets_dict_to_yaml(datasets_dict, name=\"datasets.yaml\"):\n    with open(name, \"w\") as file:\n        yaml.dump(datasets_dict, file)\n\n\ndef create_dataset_dict(dataset):\n    dataset_dict = {\n        \"dataset\": dataset.name,\n        \"user_requirement\": dataset.create_base_requirement(),\n        \"metric\": dataset.get_metric(),\n        \"target_col\": dataset.target_col,\n    }\n    return dataset_dict\n","sourceCodeStart":123,"sourceCodeEnd":159,"githubUrl":"https://github.com/FoundationAgents/MetaGPT/blob/11cdf466d042aece04fc6cfd13b28e1a70341b1f/metagpt/ext/sela/data/dataset.py#L123-L159","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","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)"],"exampleFix":null,"handlingStrategy":"validation","validationCode":"assert task_name in config[\"datasets\"], f\"{task_name} not registered\"","typeGuard":"def is_registered_task(task_name: str, config: dict) -> bool:\n    return task_name in config.get(\"datasets\", {})","tryCatchPattern":null,"preventionTips":["Validate task names against the yaml at startup","Keep a single source of truth for task names"],"tags":["sela","config","dataset","validation"],"backgroundTag":null,"analyzedSha":"11cdf466d042aece04fc6cfd13b28e1a70341b1f","analyzedAt":"2026-08-14T23:20:02.994Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}