unslothai/unsloth · error · ValueError

Unsupported unstructured seed file type: {ext}

Error message

Unsupported unstructured seed file type: {ext}

What it means

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.

Source

Thrown at studio/backend/plugins/data-designer-unstructured-seed/src/data_designer_unstructured_seed/chunking.py:184

        )
        for chunk in chunks:
            all_rows.append({"chunk_text": chunk, "source_file": orig_name})

    if not all_rows:
        raise ValueError("No text found in any uploaded files.")

    df = pd.DataFrame(all_rows)
    ensure_dir(_CACHE_DIR)
    tmp = _CACHE_DIR / f"{cache_key}.tmp.parquet"
    df.to_parquet(tmp, index = False)
    tmp.replace(cached)
    return cached, all_rows


def load_unstructured_text_file(path: Path) -> str:
    ext = path.suffix.lower()
    if ext not in {".txt", ".md"}:
        raise ValueError(f"Unsupported unstructured seed file type: {ext}")

    raw = path.read_text(encoding = "utf-8", errors = "ignore")
    return normalize_unstructured_text(raw)


def normalize_unstructured_text(text: str) -> str:
    normalized = text.replace("\r\n", "\n").replace("\r", "\n")
    return re.sub(r"\n{3,}", "\n\n", normalized).strip()


def split_text_into_chunks(*, text: str, chunk_size: int, chunk_overlap: int) -> list[str]:
    if not text:
        return []
    if chunk_size <= 0:
        return [text]

    chunks: list[str] = []
    start = 0

View on GitHub (pinned to 203007d190)

Solutions

  1. Convert the document to plain text first (pdftotext, python-docx, pandoc) and save as .txt or .md.
  2. If the file is already text but has a wrong extension, rename it: mv notes.log notes.txt.
  3. Check for double extensions or trailing characters in the filename.

Example fix

# before
source_path = Path("report.pdf")

# after
$ pdftotext report.pdf report.txt
source_path = Path("report.txt")
Defensive patterns

Strategy: type-guard

Validate before calling

SUPPORTED_EXTS = {".txt", ".md"}

def is_supported_seed_file(path: str) -> bool:
    from pathlib import Path
    return Path(path).suffix.lower() in SUPPORTED_EXTS

Type guard

from pathlib import Path

SUPPORTED_EXTS = {".txt", ".md"}

def is_text_seed(p: Path) -> bool:
    """Narrow to files the unstructured seed plugin can load."""
    return p.is_file() and p.suffix.lower() in SUPPORTED_EXTS

Prevention

When it happens

Trigger: 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.

Common situations: 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.

Related errors


AI-assisted analysis of unslothai/unsloth@203007d190 (2026-08-15). Data as JSON: /api/errors/5fd22e27ac901686. Report an issue: GitHub.