{"record":{"id":"9b8625c0986bfac5","repo":"hiyouga/LlamaFactory","slug":"allowed-file-types","errorCode":null,"errorMessage":"Allowed file types: {}.","messagePattern":"Allowed file types: (.+?)\\.","errorType":"exception","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"src/llamafactory/data/loader.py","lineNumber":86,"sourceCode":"        data_dir = dataset_attr.folder\n\n    elif dataset_attr.load_from == \"cloud_file\":\n        data_path = dataset_attr.dataset_name\n\n    elif dataset_attr.load_from == \"file\":\n        data_files = []\n        local_path = os.path.join(data_args.dataset_dir, dataset_attr.dataset_name)\n        if os.path.isdir(local_path):  # is directory\n            for file_name in os.listdir(local_path):\n                data_files.append(os.path.join(local_path, file_name))\n        elif os.path.isfile(local_path):  # is file\n            data_files.append(local_path)\n        else:\n            raise ValueError(f\"File {local_path} not found.\")\n\n        data_path = FILEEXT2TYPE.get(os.path.splitext(data_files[0])[-1][1:], None)\n        if data_path is None:\n            raise ValueError(\"Allowed file types: {}.\".format(\",\".join(FILEEXT2TYPE.keys())))\n\n        if any(data_path != FILEEXT2TYPE.get(os.path.splitext(data_file)[-1][1:], None) for data_file in data_files):\n            raise ValueError(\"File types should be identical.\")\n    else:\n        raise NotImplementedError(f\"Unknown load type: {dataset_attr.load_from}.\")\n\n    if dataset_attr.load_from == \"ms_hub\":\n        check_version(\"modelscope>=1.14.0\", mandatory=True)\n        from modelscope import MsDataset  # type: ignore\n        from modelscope.utils.config_ds import MS_DATASETS_CACHE  # type: ignore\n\n        cache_dir = model_args.cache_dir or MS_DATASETS_CACHE\n        dataset = MsDataset.load(\n            dataset_name=data_path,\n            subset_name=data_name,\n            data_dir=data_dir,\n            data_files=data_files,\n            split=dataset_attr.split,","sourceCodeStart":68,"sourceCodeEnd":104,"githubUrl":"https://github.com/hiyouga/LlamaFactory/blob/f28afaf6355af515454dfb16c97d728307c93897/src/llamafactory/data/loader.py#L68-L104","documentation":"Raised when a local dataset file's extension is not a key in FILEEXT2TYPE, the map of supported dataset formats (json, jsonl, csv, parquet, and similar). The extension is taken from the first file found (os.path.splitext(data_files[0])[-1][1:]); an unmapped extension produces None and this ValueError listing the allowed types.","triggerScenarios":"Pointing a \"file\"-type dataset at a .txt, .xlsx, .arrow, .json.gz, or extensionless file; also when a dataset directory's first listed entry has an unusual extension even if other files are supported.","commonSituations":"Users dropping raw exported spreadsheets or text logs into data/; double extensions like data.jsonl.backup; uppercase extensions on case-sensitive filesystems; gzipped JSONL files.","solutions":["Convert the file to one of the allowed types listed in the message — most simply JSONL (one JSON object per line) or CSV.","Rename to a supported exact extension (.json, .jsonl, .csv, .parquet) and remove double extensions.","For Excel/other formats, export to CSV/JSON first with pandas or another tool.","If the data is gzipped, decompress it so the final extension matches a supported type."],"exampleFix":"# before\n\"mydata\": {\"file_name\": \"conversations.xlsx\"}\n\n# after (convert once)\nimport pandas as pd\npd.read_excel(\"data/conversations.xlsx\").to_json(\"data/conversations.jsonl\", orient=\"records\", lines=True, force_ascii=False)\n# \"mydata\": {\"file_name\": \"conversations.jsonl\"}","handlingStrategy":"validation","validationCode":"from llamafactory.extras.constants import FILEEXT2TYPE\nimport os\n\ndef ext_supported(path: str) -> bool:\n    return os.path.splitext(path)[-1][1:] in FILEEXT2TYPE","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Standardize team datasets on .jsonl.","Convert Excel/text exports to JSONL in the ingestion pipeline, not at training time.","Beware double extensions and case differences."],"tags":["dataset","file-format","config"],"backgroundTag":null,"analyzedSha":"f28afaf6355af515454dfb16c97d728307c93897","analyzedAt":"2026-08-14T21:57:28.298Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}