{"record":{"id":"d0045add2d8ec46e","repo":"unslothai/unsloth","slug":"no-text-found-in-unstructured-seed-source","errorCode":null,"errorMessage":"No text found in unstructured seed source.","messagePattern":"No text found in unstructured seed source\\.","errorType":"exception","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"studio/backend/plugins/data-designer-unstructured-seed/src/data_designer_unstructured_seed/chunking.py","lineNumber":129,"sourceCode":"\n    size, overlap = resolve_chunking(chunk_size, chunk_overlap)\n    key = _compute_cache_key(\n        source_path = resolved,\n        chunk_size = size,\n        chunk_overlap = overlap,\n    )\n    parquet_path = _CACHE_DIR / f\"{key}.parquet\"\n    if parquet_path.exists():\n        return parquet_path, []\n\n    text = load_unstructured_text_file(resolved)\n    chunks = split_text_into_chunks(\n        text = text,\n        chunk_size = size,\n        chunk_overlap = overlap,\n    )\n    if not chunks:\n        raise ValueError(\"No text found in unstructured seed source.\")\n\n    rows = [{\"chunk_text\": chunk} for chunk in chunks]\n    ensure_dir(_CACHE_DIR)\n    try:\n        import pandas as pd\n    except ImportError as exc:  # pragma: no cover\n        raise RuntimeError(f\"pandas is required for unstructured seed processing: {exc}\") from exc\n\n    tmp_path = _CACHE_DIR / f\"{key}.tmp.parquet\"\n    pd.DataFrame(rows).to_parquet(tmp_path, index = False)\n    tmp_path.replace(parquet_path)\n    return parquet_path, rows\n\n\ndef materialize_multi_file_unstructured_seed(\n    *,\n    file_entries: list[tuple[Path, str]],  # (extracted_txt_path, original_filename)\n    chunk_size: int,","sourceCodeStart":111,"sourceCodeEnd":147,"githubUrl":"https://github.com/unslothai/unsloth/blob/203007d19051dcd2ae33876786d117c99f6b0368/studio/backend/plugins/data-designer-unstructured-seed/src/data_designer_unstructured_seed/chunking.py#L111-L147","documentation":"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.","triggerScenarios":"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.","commonSituations":"Uploading a zero-byte file or a placeholder; a scraper upstream wrote an empty output file; a file that is only BOM/whitespace characters.","solutions":["Check the file content: wc -c <file> and cat it — confirm it has non-whitespace text.","Regenerate or re-export the source file if a previous step truncated it.","Remove the empty file from the batch instead of passing it as a seed source."],"exampleFix":"# before\nsource_path = Path(\"seed.txt\")  # empty file\n\n# after\n# ensure seed.txt contains actual text, e.g.:\n$ printf 'Some real seed content.\\n' > seed.txt","handlingStrategy":"validation","validationCode":"from pathlib import Path\n\ndef seed_has_text(source_path: str | Path) -> bool:\n    p = Path(source_path)\n    if not p.is_file():\n        return False\n    return bool(p.read_text(encoding=\"utf-8\", errors=\"ignore\").strip())","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Reject zero-byte and whitespace-only uploads at the API boundary.","Log extracted-text byte counts per source file during ingestion."],"tags":["empty-file","validation","plugin","chunking"],"backgroundTag":null,"analyzedSha":"203007d19051dcd2ae33876786d117c99f6b0368","analyzedAt":"2026-08-15T02:48:39.846Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}