{"record":{"id":"1539362c86de3a75","repo":"ultralytics/yolov5","slug":"more-than-one-yaml-file-was-found-in-the-dataset-r","errorCode":null,"errorMessage":"More than one yaml file was found in the dataset root, cannot determine which one contains the dataset definition this way.","messagePattern":"More than one yaml file was found in the dataset root, cannot determine which one contains the dataset definition this way\\.","errorType":"exception","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"utils/loggers/clearml/clearml_utils.py","lineNumber":50,"sourceCode":"    \"host is required in init or config\",\n    \"Could not get access credentials\",\n)\n\n\nclass ClearmlNotConfiguredError(ValueError):\n    \"\"\"Raised when ClearML is installed but not configured for task logging.\"\"\"\n\n\ndef construct_dataset(clearml_info_string):\n    \"\"\"Load in a clearml dataset and fill the internal data_dict with its contents.\"\"\"\n    dataset_id = clearml_info_string.replace(\"clearml://\", \"\")\n    dataset = Dataset.get(dataset_id=dataset_id)\n    dataset_root_path = Path(dataset.get_local_copy())\n\n    # We'll search for the yaml file definition in the dataset\n    yaml_filenames = list(glob.glob(str(dataset_root_path / \"*.yaml\")) + glob.glob(str(dataset_root_path / \"*.yml\")))\n    if len(yaml_filenames) > 1:\n        raise ValueError(\n            \"More than one yaml file was found in the dataset root, cannot determine which one contains \"\n            \"the dataset definition this way.\"\n        )\n    elif not yaml_filenames:\n        raise ValueError(\n            \"No yaml definition found in dataset root path, check that there is a correct yaml file \"\n            \"inside the dataset root path.\"\n        )\n    with open(yaml_filenames[0]) as f:\n        dataset_definition = yaml.safe_load(f)\n\n    assert set(dataset_definition.keys()).issuperset({\"train\", \"test\", \"val\", \"nc\", \"names\"}), (\n        \"The right keys were not found in the yaml file, make sure it at least has the following keys: ('train', 'test', 'val', 'nc', 'names')\"\n    )\n\n    data_dict = {\n        \"train\": (\n            str((dataset_root_path / dataset_definition[\"train\"]).resolve()) if dataset_definition[\"train\"] else None","sourceCodeStart":32,"sourceCodeEnd":68,"githubUrl":"https://github.com/ultralytics/yolov5/blob/20d1d78a08277e365d57bfa3a2cce752772d9e59/utils/loggers/clearml/clearml_utils.py#L32-L68","documentation":"clearml_utils.construct_dataset raises ValueError when the local copy of a 'clearml://' dataset contains more than one .yaml/.yml file in its root. The loader globs *.yaml and *.yml and must pick exactly one dataset definition unambiguously; multiple matches (e.g. a data yaml plus an unrelated config yaml uploaded alongside) make the choice undefined, so it aborts.","triggerScenarios":"Passing data='clearml://<dataset_id>' where the ClearML dataset version was uploaded with both data.yaml and, say, hyp.yml or a README yaml in the root; re-uploading a dataset with an extra yaml artifact; syncing a folder that already contained a yolov5 yaml.","commonSituations":"Iterating on ClearML dataset versions and accidentally adding config files; teams uploading the whole repo directory into the dataset; yaml backups (data.yaml.bak renamed to .yml).","solutions":["Create a new ClearML dataset version whose root contains exactly one yaml/yml dataset definition; remove extras with dataset.remove_files or by re-uploading a clean folder.","Keep auxiliary configs (hyperparameters, readme) out of the dataset root or under a subdirectory the glob does not hit.","After cleanup, rerun with the new clearml://<id> in --data."],"exampleFix":"# before: dataset root contains data.yaml + hyp.yaml -> ValueError\n# clearml-data sync --project yolo --name mydata --folder ./data_root\n\n# after: root contains only data.yaml\nclearml-data sync --project yolo --name mydata --folder ./clean_root  # clean_root/data.yaml only","handlingStrategy":"validation","validationCode":"from pathlib import Path\nimport glob as _glob\n\ndef clearml_yaml_unique(root: str) -> bool:\n    hits = _glob.glob(str(Path(root) / '*.yaml')) + _glob.glob(str(Path(root) / '*.yml'))\n    return len(hits) == 1","typeGuard":null,"tryCatchPattern":"try:\n    data_dict = construct_dataset(f'clearml://{dataset_id}')\nexcept ValueError as e:\n    if 'More than one yaml' in str(e):\n        raise SystemExit('remove extra yaml/yml files from the dataset root and publish a new version') from e","preventionTips":["Keep exactly one dataset-definition yaml at the dataset root.","Store hyperparameter/config yamls outside the ClearML dataset folder."],"tags":["clearml","dataset","config","ambiguity"],"backgroundTag":null,"analyzedSha":"20d1d78a08277e365d57bfa3a2cce752772d9e59","analyzedAt":"2026-08-15T02:56:15.443Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}