{"record":{"id":"5d89e57d0c9cfdb3","repo":"unslothai/unsloth","slug":"unsupported-file-format-dataset-path-suffix","errorCode":null,"errorMessage":"Unsupported file format: {dataset_path.suffix}","messagePattern":"Unsupported file format: (.+?)","errorType":"http","errorClass":"HTTPException","httpStatus":400,"severity":"error","filePath":"studio/backend/hub/services/datasets/local.py","lineNumber":274,"sourceCode":"\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,\n                detail = \"Dataset appears to be empty or could not be read\",\n            )\n        return preview\n\n    raise HTTPException(status_code = 400, detail = f\"Unsupported file format: {dataset_path.suffix}\")\n\n\ndef _sanitize_filename(filename: str) -> str:\n    name = Path(filename).name.strip().replace(\"\\x00\", \"\")\n    if not name:\n        return \"dataset_upload\"\n    return name\n\n\ndef _upload_too_large(limit_label: str) -> HTTPException:\n    return HTTPException(\n        status_code = 413,\n        detail = f\"Training dataset upload too large. Maximum is {limit_label}.\",\n    )\n\n\ndef _upload_destination(filename: str) -> tuple[str, Path, int, str]:\n    filename = _sanitize_filename(filename)","sourceCodeStart":256,"sourceCodeEnd":292,"githubUrl":"https://github.com/unslothai/unsloth/blob/203007d19051dcd2ae33876786d117c99f6b0368/studio/backend/hub/services/datasets/local.py#L256-L292","documentation":"HTTP 400 from local preview when the selected file's lowercased suffix is neither .parquet (exact-count branch), .json/.jsonl/.csv (stream branch) — i.e. the file passed directory candidate selection but has an extension the per-file loader does not handle. This is the terminal fallthrough of the format ladder, so any exotic suffix lands here.","triggerScenarios":"Previewing a single file with suffixes like .arrow, .tsv, .xlsx, .txt, or no suffix; a path whose stem contains dots confusing naive clients (suffix itself is still checked correctly).","commonSituations":"Users dropping Excel exports (.xlsx) or TSV files and expecting preview; datasets tools exporting .arrow shards; case variants are handled (.PARQUET works) but format variants are not.","solutions":["Convert the file to one of parquet/json/jsonl/csv before previewing.","For .tsv, rename/save as .csv with comma separators (or convert properly with pandas).","For .arrow, convert with pyarrow to parquet.","Check the reported suffix in the detail message — occasionally a double extension like data.parquet.csv is the real culprit."],"exampleFix":"# pandas convert before preview\nimport pandas as pd\npd.read_excel(\"sales.xlsx\").to_parquet(\"sales.parquet\")","handlingStrategy":"type-guard","validationCode":"SUPPORTED = {\".parquet\", \".json\", \".jsonl\", \".csv\"}\n\ndef suffix_ok(path: Path) -> bool:\n    return path.suffix.lower() in SUPPORTED","typeGuard":"def is_supported_file(path: Path) -> TypeGuard[Path]:\n    return path.is_file() and path.suffix.lower() in {\".parquet\", \".json\", \".jsonl\", \".csv\"}","tryCatchPattern":null,"preventionTips":["Constrain file pickers with the supported suffix list before selection.","Convert .arrow/.tsv/.xlsx exports to parquet or csv as a standard pipeline step.","Watch for double extensions (data.parquet.csv) — the last suffix is what counts."],"tags":["local-dataset","file-format","http-400","validation"],"backgroundTag":null,"analyzedSha":"203007d19051dcd2ae33876786d117c99f6b0368","analyzedAt":"2026-08-15T02:48:39.846Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}