{"record":{"id":"5fd22e27ac901686","repo":"unslothai/unsloth","slug":"unsupported-unstructured-seed-file-type-ext","errorCode":null,"errorMessage":"Unsupported unstructured seed file type: {ext}","messagePattern":"Unsupported unstructured seed file type: (.+?)","errorType":"exception","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"studio/backend/plugins/data-designer-unstructured-seed/src/data_designer_unstructured_seed/chunking.py","lineNumber":184,"sourceCode":"        )\n        for chunk in chunks:\n            all_rows.append({\"chunk_text\": chunk, \"source_file\": orig_name})\n\n    if not all_rows:\n        raise ValueError(\"No text found in any uploaded files.\")\n\n    df = pd.DataFrame(all_rows)\n    ensure_dir(_CACHE_DIR)\n    tmp = _CACHE_DIR / f\"{cache_key}.tmp.parquet\"\n    df.to_parquet(tmp, index = False)\n    tmp.replace(cached)\n    return cached, all_rows\n\n\ndef load_unstructured_text_file(path: Path) -> str:\n    ext = path.suffix.lower()\n    if ext not in {\".txt\", \".md\"}:\n        raise ValueError(f\"Unsupported unstructured seed file type: {ext}\")\n\n    raw = path.read_text(encoding = \"utf-8\", errors = \"ignore\")\n    return normalize_unstructured_text(raw)\n\n\ndef normalize_unstructured_text(text: str) -> str:\n    normalized = text.replace(\"\\r\\n\", \"\\n\").replace(\"\\r\", \"\\n\")\n    return re.sub(r\"\\n{3,}\", \"\\n\\n\", normalized).strip()\n\n\ndef split_text_into_chunks(*, text: str, chunk_size: int, chunk_overlap: int) -> list[str]:\n    if not text:\n        return []\n    if chunk_size <= 0:\n        return [text]\n\n    chunks: list[str] = []\n    start = 0","sourceCodeStart":166,"sourceCodeEnd":202,"githubUrl":"https://github.com/unslothai/unsloth/blob/203007d19051dcd2ae33876786d117c99f6b0368/studio/backend/plugins/data-designer-unstructured-seed/src/data_designer_unstructured_seed/chunking.py#L166-L202","documentation":"ValueError raised by load_unstructured_text_file when the path's lowercased suffix is not '.txt' or '.md'. The plugin deliberately supports only plain-text and Markdown sources; other formats are rejected before reading so no binary garbage gets normalized into the chunk pipeline.","triggerScenarios":"Passing source_path (or a multi-file entry) ending in .pdf, .docx, .html, .csv, .json, or any extension other than .txt/.md. Case-insensitive: '.TXT' is fine, '.pdf' is not.","commonSituations":"Users assuming the seed source accepts PDFs/Word docs like a generic 'unstructured' loader; extraction pipeline writing files with a double extension ('file.txt.pdf'); renaming a binary file to .txt is accepted but content errors suggest checking the original format first.","solutions":["Convert the document to plain text first (pdftotext, python-docx, pandoc) and save as .txt or .md.","If the file is already text but has a wrong extension, rename it: mv notes.log notes.txt.","Check for double extensions or trailing characters in the filename."],"exampleFix":"# before\nsource_path = Path(\"report.pdf\")\n\n# after\n$ pdftotext report.pdf report.txt\nsource_path = Path(\"report.txt\")","handlingStrategy":"type-guard","validationCode":"SUPPORTED_EXTS = {\".txt\", \".md\"}\n\ndef is_supported_seed_file(path: str) -> bool:\n    from pathlib import Path\n    return Path(path).suffix.lower() in SUPPORTED_EXTS","typeGuard":"from pathlib import Path\n\nSUPPORTED_EXTS = {\".txt\", \".md\"}\n\ndef is_text_seed(p: Path) -> bool:\n    \"\"\"Narrow to files the unstructured seed plugin can load.\"\"\"\n    return p.is_file() and p.suffix.lower() in SUPPORTED_EXTS","tryCatchPattern":null,"preventionTips":["Restrict the upload accept attribute to .txt,.md in the UI.","Convert PDFs/DOCX to .txt in an upstream extraction step before seeding.","Check for double extensions (file.txt.pdf) when staging files."],"tags":["file-type","validation","plugin","chunking"],"backgroundTag":null,"analyzedSha":"203007d19051dcd2ae33876786d117c99f6b0368","analyzedAt":"2026-08-15T02:48:39.846Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}