{"record":{"id":"fc13fe20b0820eed","repo":"hiyouga/LlamaFactory","slug":"undefined-dataset-name-in-data-config","errorCode":null,"errorMessage":"Undefined dataset {name} in {DATA_CONFIG}.","messagePattern":"Undefined dataset (.+?) in (.+?)\\.","errorType":"exception","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"src/llamafactory/data/parser.py","lineNumber":126,"sourceCode":"        try:\n            with open(config_path) as f:\n                dataset_info = json.load(f)\n        except Exception as err:\n            if len(dataset_names) != 0:\n                raise ValueError(f\"Cannot open {config_path} due to {str(err)}.\")\n\n            dataset_info = None\n\n    dataset_list: list[DatasetAttr] = []\n    for name in dataset_names:\n        if dataset_info is None:  # dataset_dir is ONLINE\n            load_from = \"ms_hub\" if use_modelscope() else \"om_hub\" if use_openmind() else \"hf_hub\"\n            dataset_attr = DatasetAttr(load_from, dataset_name=name)\n            dataset_list.append(dataset_attr)\n            continue\n\n        if name not in dataset_info:\n            raise ValueError(f\"Undefined dataset {name} in {DATA_CONFIG}.\")\n\n        has_hf_url = \"hf_hub_url\" in dataset_info[name]\n        has_ms_url = \"ms_hub_url\" in dataset_info[name]\n        has_om_url = \"om_hub_url\" in dataset_info[name]\n\n        if has_hf_url or has_ms_url or has_om_url:\n            if has_ms_url and (use_modelscope() or not has_hf_url):\n                dataset_attr = DatasetAttr(\"ms_hub\", dataset_name=dataset_info[name][\"ms_hub_url\"])\n            elif has_om_url and (use_openmind() or not has_hf_url):\n                dataset_attr = DatasetAttr(\"om_hub\", dataset_name=dataset_info[name][\"om_hub_url\"])\n            else:\n                dataset_attr = DatasetAttr(\"hf_hub\", dataset_name=dataset_info[name][\"hf_hub_url\"])\n        elif \"script_url\" in dataset_info[name]:\n            dataset_attr = DatasetAttr(\"script\", dataset_name=dataset_info[name][\"script_url\"])\n        elif \"cloud_file_name\" in dataset_info[name]:\n            dataset_attr = DatasetAttr(\"cloud_file\", dataset_name=dataset_info[name][\"cloud_file_name\"])\n        else:\n            dataset_attr = DatasetAttr(\"file\", dataset_name=dataset_info[name][\"file_name\"])","sourceCodeStart":108,"sourceCodeEnd":144,"githubUrl":"https://github.com/hiyouga/LlamaFactory/blob/f28afaf6355af515454dfb16c97d728307c93897/src/llamafactory/data/parser.py#L108-L144","documentation":"Raised when a requested dataset name has no entry in the loaded dataset_info.json dict. Every name in the `dataset` field must be a key in that config (defining file_name, columns, formatting, etc.) before it can be loaded.","triggerScenarios":"YAML dataset: my_data while dataset_info.json only defines e.g. 'alpaca_zh'; renaming a dataset in the config but not the YAML (or vice versa); trailing spaces in the name.","commonSituations":"Copy-paste example configs that reference datasets not present in the user's dataset_info.json; case sensitivity ('Alpaca' vs 'alpaca'); editing the JSON but forgetting to save/re-run.","solutions":["Open dataset_info.json and add an entry for the missing name, e.g. `\"my_data\": {\"file_name\": \"my_data.json\"}` with the data file placed in the same directory.","Or change the YAML dataset field to a name that already exists in dataset_info.json.","Check exact spelling and case; JSON keys are case-sensitive."],"exampleFix":"### before\n# dataset_info.json has no \"my_data\" key; yaml uses\ndataset: my_data\n### after\n# data/dataset_info.json\n\"my_data\": {\"file_name\": \"my_data.json\", \"formatting\": \"sharegpt\", ...}\n# yaml unchanged","handlingStrategy":"validation","validationCode":"import json, os\n\ncfg = json.load(open(os.path.join(dataset_dir, 'dataset_info.json')))\nmissing = [d for d in dataset_names if d not in cfg]\nassert not missing, f'undefined datasets: {missing}; defined: {sorted(cfg)}'","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Keep dataset names in the YAML and keys in dataset_info.json generated from one source of truth.","Names are case-sensitive; avoid renames late in a run setup."],"tags":["dataset-config","config-typo","json","data-preparation"],"backgroundTag":null,"analyzedSha":"f28afaf6355af515454dfb16c97d728307c93897","analyzedAt":"2026-08-14T21:57:28.298Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}