{"record":{"id":"22fb541183784a17","repo":"unslothai/unsloth","slug":"unsupported-local-dataset-directory-expected-parq","errorCode":null,"errorMessage":"Unsupported local dataset directory (expected parquet/json/jsonl/csv files)","messagePattern":"Unsupported local dataset directory \\(expected parquet/json/jsonl/csv files\\)","errorType":"http","errorClass":"HTTPException","httpStatus":400,"severity":"error","filePath":"studio/backend/hub/services/datasets/local.py","lineNumber":251,"sourceCode":"            if (dataset_path / \"parquet-files\").exists()\n            else dataset_path\n        )\n        parquet_files = sorted(parquet_dir.glob(\"*.parquet\"))\n        if parquet_files:\n            dataset = load_dataset(\n                \"parquet\",\n                data_files = [str(path) for path in parquet_files],\n                split = train_split,\n            )\n            total_rows = len(dataset)\n            preview_slice = dataset.select(range(min(preview_size, total_rows)))\n            return preview_slice, total_rows\n\n        candidate_files: list[Path] = []\n        for ext in LOCAL_FILE_EXTS:\n            candidate_files.extend(sorted(dataset_path.glob(f\"*{ext}\")))\n        if not candidate_files:\n            raise HTTPException(\n                status_code = 400,\n                detail = \"Unsupported local dataset directory (expected parquet/json/jsonl/csv files)\",\n            )\n        dataset_path = candidate_files[0]\n\n    suffix = dataset_path.suffix.lower()\n    # Parquet/Arrow give a cheap exact total_rows; JSON/CSV carry none, so stream and report None.\n    if suffix == \".parquet\":\n        dataset = load_dataset(\"parquet\", data_files = str(dataset_path), split = train_split)\n        total_rows = len(dataset)\n        preview_slice = dataset.select(range(min(preview_size, total_rows)))\n        return preview_slice, total_rows\n\n    if suffix in (\".json\", \".jsonl\", \".csv\"):\n        preview = _stream_file_preview_slice(dataset_path, preview_size)\n        if preview is None:\n            raise HTTPException(\n                status_code = 400,","sourceCodeStart":233,"sourceCodeEnd":269,"githubUrl":"https://github.com/unslothai/unsloth/blob/203007d19051dcd2ae33876786d117c99f6b0368/studio/backend/hub/services/datasets/local.py#L233-L269","documentation":"HTTP 400 from local dataset preview loading when the target is a directory that contains no files matching LOCAL_FILE_EXTS (parquet/json/jsonl/csv) after the parquet-multi-file branch also found nothing. The directory exists but holds no recognizable dataset files, so Studio refuses to guess.","triggerScenarios":"Previewing a directory of images, text files, .arrow files not in the ext list, nested subdirectories (glob is `*{ext}`, non-recursive), or an empty dir.","commonSituations":"User points Studio at a folder of raw .txt/.jpg files; data lives one level deeper (e.g. `data/`); dataset repo cloned with git LFS pointers instead of real parquet files.","solutions":["Move or place at least one .parquet/.json/.jsonl/.csv file directly (non-nested) in the directory.","If files sit in a subfolder, select/point at that subfolder instead of the parent.","If files are git-LFS pointer stubs, run `git lfs pull` so real data files exist on disk.","Convert unsupported formats (e.g. .xlsx, .arrow) to parquet or csv before previewing."],"exampleFix":"# before: my_dataset/README.md, my_dataset/data/part-0.parquet\n# after (point at the folder holding the files, or flatten):\n# my_dataset/part-0.parquet","handlingStrategy":"validation","validationCode":"from pathlib import Path\n\nLOCAL_FILE_EXTS = (\".parquet\", \".json\", \".jsonl\", \".csv\")\n\ndef dir_has_dataset_files(root: Path) -> bool:\n    return any(p.is_file() and p.suffix.lower() in LOCAL_FILE_EXTS for p in root.glob(\"*\"))","typeGuard":"def is_previewable_dir(root: Path) -> TypeGuard[Path]:\n    return root.is_dir() and dir_has_dataset_files(root)","tryCatchPattern":"try:\n    load_preview(path)\nexcept HTTPException as e:\n    if e.status_code == 400 and \"Unsupported local dataset directory\" in e.detail:\n        show_format_help(allowed=LOCAL_FILE_EXTS)\n    else:\n        raise","preventionTips":["Remember the glob is non-recursive: dataset files must sit directly in the folder.","Filter the dataset picker to directories containing supported extensions.","Run `git lfs pull` on cloned dataset repos so real data files exist."],"tags":["local-dataset","validation","http-400","file-format"],"backgroundTag":null,"analyzedSha":"203007d19051dcd2ae33876786d117c99f6b0368","analyzedAt":"2026-08-15T02:48:39.846Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}