unslothai/unsloth · error · ValueError

Seed file does not exist: {expanded}

Error message

Seed file does not exist: {expanded}

What it means

A pydantic field validator on the `paths` field of the data-designer-unstructured-seed plugin config rejects configuration whose seed file path does not resolve to an existing regular file after `Path.expanduser()`. It is raised as a ValueError inside `@field_validator("paths")`, so pydantic surfaces it as a ValidationError when the plugin config is instantiated. The check runs at config-load time to fail fast before any ingestion starts.

Source

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

    @model_validator(mode = "before")
    @classmethod
    def _normalize_legacy_path(cls, data):
        if isinstance(data, dict) and "paths" not in data and data.get("path"):
            data = dict(data)
            data["paths"] = [data["path"]]
        return data

    chunk_size: int = DEFAULT_CHUNK_SIZE
    chunk_overlap: int = DEFAULT_CHUNK_OVERLAP

    @field_validator("paths")
    @classmethod
    def _validate_paths(cls, v: list[str]) -> list[str]:
        for p in v:
            expanded = Path(p).expanduser()
            if not expanded.is_file():
                raise ValueError(f"Seed file does not exist: {expanded}")
        return v

    @field_validator("chunk_size")
    @classmethod
    def _resolve_chunk_size(cls, v: int) -> int:
        cs, _ = resolve_chunking(v, 0)
        return cs

    @field_validator("chunk_overlap")
    @classmethod
    def _resolve_chunk_overlap(cls, v: int, info) -> int:
        cs = info.data.get("chunk_size", DEFAULT_CHUNK_SIZE)
        _, co = resolve_chunking(cs, v)
        return co

View on GitHub (pinned to 203007d190)

Solutions

  1. Check the path exists before building the config: `Path(p).expanduser().is_file()`
  2. Use an absolute path for seed files, or resolve relative paths against an explicit base directory before passing them in
  3. If the file should have been produced by an earlier pipeline stage, verify that stage ran and wrote the expected output before loading this config
  4. Confirm you are not accidentally passing a directory or a glob pattern; the validator requires one concrete file per entry

Example fix

// before
config = SeedConfig(path="~/data/seeds")  # directory, or missing file
// after
from pathlib import Path
p = Path("~/data/seeds.jsonl").expanduser().resolve()
if not p.is_file():
    raise FileNotFoundError(f"seed file missing: {p}")
config = SeedConfig(path=str(p))
Defensive patterns

Strategy: validation

Validate before calling

from pathlib import Path

def valid_seed_paths(paths: list[str]) -> bool:
    return all(Path(p).expanduser().is_file() for p in paths)

Try / catch

from pydantic import ValidationError

try:
    cfg = SeedConfig(paths=[p])
except ValidationError as e:
    if "Seed file does not exist" in str(e):
        raise FileNotFoundError(f"missing seed file: {p}") from e
    raise

Prevention

When it happens

Trigger: Instantiating the seed config (directly or via plugin load) with `path`/`paths` entries that (a) point to a nonexistent file, (b) point to a directory, or (c) use a `~user` or env-style string that expanduser() does not resolve to the intended location. Also triggered by relative paths evaluated against an unexpected working directory.

Common situations: Typos or stale paths in a seed config file; running the backend from a different cwd so relative seed paths break; paths copied from another machine/user where the home directory differs; the seed file not yet downloaded/generated when the pipeline starts.

Related errors


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