unslothai/unsloth · error · ValueError

No text found in unstructured seed source.

Error message

No text found in unstructured seed source.

What it means

ValueError raised by materialize_unstructured_seed_dataset when the source file exists and was read successfully, but splitting it into chunks produced zero chunks — i.e. the file contains no usable text after normalization (newline normalization and stripping of 3+ consecutive newlines). It fires before any parquet is written, so an empty dataset is never cached.

Source

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

    size, overlap = resolve_chunking(chunk_size, chunk_overlap)
    key = _compute_cache_key(
        source_path = resolved,
        chunk_size = size,
        chunk_overlap = overlap,
    )
    parquet_path = _CACHE_DIR / f"{key}.parquet"
    if parquet_path.exists():
        return parquet_path, []

    text = load_unstructured_text_file(resolved)
    chunks = split_text_into_chunks(
        text = text,
        chunk_size = size,
        chunk_overlap = overlap,
    )
    if not chunks:
        raise ValueError("No text found in unstructured seed source.")

    rows = [{"chunk_text": chunk} for chunk in chunks]
    ensure_dir(_CACHE_DIR)
    try:
        import pandas as pd
    except ImportError as exc:  # pragma: no cover
        raise RuntimeError(f"pandas is required for unstructured seed processing: {exc}") from exc

    tmp_path = _CACHE_DIR / f"{key}.tmp.parquet"
    pd.DataFrame(rows).to_parquet(tmp_path, index = False)
    tmp_path.replace(parquet_path)
    return parquet_path, rows


def materialize_multi_file_unstructured_seed(
    *,
    file_entries: list[tuple[Path, str]],  # (extracted_txt_path, original_filename)
    chunk_size: int,

View on GitHub (pinned to 203007d190)

Solutions

  1. Check the file content: wc -c <file> and cat it — confirm it has non-whitespace text.
  2. Regenerate or re-export the source file if a previous step truncated it.
  3. Remove the empty file from the batch instead of passing it as a seed source.

Example fix

# before
source_path = Path("seed.txt")  # empty file

# after
# ensure seed.txt contains actual text, e.g.:
$ printf 'Some real seed content.\n' > seed.txt
Defensive patterns

Strategy: validation

Validate before calling

from pathlib import Path

def seed_has_text(source_path: str | Path) -> bool:
    p = Path(source_path)
    if not p.is_file():
        return False
    return bool(p.read_text(encoding="utf-8", errors="ignore").strip())

Prevention

When it happens

Trigger: Pointing source_path at an empty .txt/.md file, a file containing only whitespace/newlines, or one whose entire content collapses to nothing after normalize_unstructured_text.

Common situations: Uploading a zero-byte file or a placeholder; a scraper upstream wrote an empty output file; a file that is only BOM/whitespace characters.

Related errors


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