{"record":{"id":"f4fb661134785ad4","repo":"unslothai/unsloth","slug":"unsupported-file-type-ext-f4fb66","errorCode":null,"errorMessage":"unsupported file type: {ext}","messagePattern":"unsupported file type: (.+?)","errorType":"http","errorClass":"HTTPException","httpStatus":422,"severity":"error","filePath":"studio/backend/routes/data_recipe/seed.py","lineNumber":235,"sourceCode":"            df.columns = df.columns.str.strip()\n            unnamed = [c for c in df.columns if c == \"\" or c.startswith(\"Unnamed:\")]\n            if unnamed:\n                df = df.drop(columns = unnamed)\n                full_df = pd.read_csv(path, encoding = \"utf-8-sig\")\n                full_df.columns = full_df.columns.str.strip()\n                full_df = full_df.drop(columns = unnamed)\n                tmp_csv = path.with_suffix(\".tmp.csv\")\n                full_df.to_csv(tmp_csv, index = False, encoding = \"utf-8\")\n                tmp_csv.replace(path)\n        elif ext == \".jsonl\":\n            df = pd.read_json(path, lines = True).head(preview_size)\n        elif ext == \".json\":\n            try:\n                df = pd.read_json(path).head(preview_size)\n            except ValueError:\n                df = pd.read_json(path, lines = True).head(preview_size)\n        else:\n            raise HTTPException(status_code = 422, detail = f\"unsupported file type: {ext}\")\n    except HTTPException:\n        raise\n    except (ValueError, OSError) as exc:\n        raise log_and_http_error(\n            exc,\n            422,\n            \"seed inspect failed\",\n            event = \"data_recipe.seed.local_preview_failed\",\n            log = logger,\n        ) from exc\n\n    rows = df.to_dict(orient = \"records\")\n    return _serialize_preview_rows(rows)\n\n\ndef _read_preview_rows_from_unstructured_file(\n    *, path: Path, preview_size: int, chunk_size: int | None, chunk_overlap: int | None\n) -> list[dict[str, Any]]:","sourceCodeStart":217,"sourceCodeEnd":253,"githubUrl":"https://github.com/unslothai/unsloth/blob/203007d19051dcd2ae33876786d117c99f6b0368/studio/backend/routes/data_recipe/seed.py#L217-L253","documentation":"HTTP 422 raised in _read_preview_rows_from_local_file when the uploaded seed file's extension is not one of the handled types (.csv, .json, .jsonl handled above; .pdf/.docx/.txt/.md go through the unstructured path). Any other extension reaches the else branch and is rejected.","triggerScenarios":"POST /seed/inspect-upload (or local-file inspect) with a file whose suffix is e.g. .xlsx, .tsv, .parquet, .zip, or empty because the original filename had no extension.","commonSituations":"User exports an Excel file and uploads it as a structured seed; file renamed losing its extension; uppercase extensions already lowercased by the code, so the real issue is a genuinely unsupported format.","solutions":["Convert the file to CSV or JSONL before uploading (e.g. pandas df.to_csv).","For documents (.pdf/.docx/.txt/.md), use the unstructured upload endpoint instead.","Rename the file so it carries a supported extension matching its actual content."],"exampleFix":"# before\npd.read_excel('data.xlsx').to_json('data.xlsx')  # still .xlsx, rejected\n\n# after\npd.read_excel('data.xlsx').to_csv('data.csv', index=False)  # .csv accepted","handlingStrategy":"validation","validationCode":"const STRUCTURED_EXTS = new Set(['.csv', '.json', '.jsonl']);\nconst ext = name.slice(name.lastIndexOf('.')).toLowerCase();\nif (!STRUCTURED_EXTS.has(ext)) throw new Error(`convert ${name} to csv/json/jsonl first`);","typeGuard":"function isStructuredSeedFile(name: string): boolean {\n  return ['.csv', '.json', '.jsonl'].includes(name.slice(name.lastIndexOf('.')).toLowerCase());\n}","tryCatchPattern":"On 422 'unsupported file type', prompt the user to convert the file; do not silently retry with the same content.","preventionTips":["Restrict the file picker accept attribute to .csv,.json,.jsonl for structured seeds.","Convert Excel/TSV to CSV in an upload pipeline before hitting the API."],"tags":["file-type","upload","validation","http-422"],"backgroundTag":null,"analyzedSha":"203007d19051dcd2ae33876786d117c99f6b0368","analyzedAt":"2026-08-15T02:48:39.846Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}