unslothai/unsloth · warning · ValueError

Provide either content_base64 or file_ids

Error message

Provide either content_base64 or file_ids

What it means

Pydantic model_validator error on SeedInspectUploadRequest when neither content_base64 nor file_ids is present — the request supplies no data to inspect at all. Exactly one of the two upload modes must be chosen.

Source

Thrown at studio/backend/models/data_recipe.py:97

    content_base64: str | None = None
    # Multi-file flow (mutually exclusive with content_base64)
    block_id: str | None = None
    file_ids: list[str] | None = None
    file_names: list[str] | None = None
    # Shared fields
    preview_size: int = Field(default = 10, ge = 1, le = 50)
    seed_source_type: str | None = None
    unstructured_chunk_size: int | None = Field(default = None, ge = 1, le = 20000)
    unstructured_chunk_overlap: int | None = Field(default = None, ge = 0, le = 20000)

    @model_validator(mode = "after")
    def _check_mutual_exclusivity(self) -> "SeedInspectUploadRequest":
        has_legacy = self.content_base64 is not None
        has_multi = self.file_ids is not None
        if has_legacy and has_multi:
            raise ValueError("Provide either content_base64 or file_ids, not both")
        if not has_legacy and not has_multi:
            raise ValueError("Provide either content_base64 or file_ids")
        if has_multi:
            if len(self.file_ids) == 0:
                raise ValueError("file_ids must not be empty")
            if not self.block_id:
                raise ValueError("block_id is required when using file_ids")
            if self.file_names is None or len(self.file_ids) != len(self.file_names):
                raise ValueError("file_names must be provided and same length as file_ids")
        if has_legacy:
            if not self.filename:
                raise ValueError("filename is required when using content_base64")
        return self


class SeedInspectResponse(BaseModel):
    dataset_name: str
    resolved_path: str
    columns: list[str] = Field(default_factory = list)
    preview_rows: list[dict[str, Any]] = Field(default_factory = list)

View on GitHub (pinned to 203007d190)

Solutions

  1. Include exactly one of content_base64 (with filename) or file_ids (with file_names and block_id) in the request.
  2. Check for key-casing mismatches — the fields are lowercase snake_case.
  3. Add a client-side check that the upload form has data before submitting.

Example fix

// before
{ "preview_size": 10 }
// after
{ "content_base64": "...", "filename": "a.jsonl", "preview_size": 10 }
Defensive patterns

Strategy: validation

Validate before calling

def has_seed_data(payload: dict) -> bool:
    return payload.get("content_base64") is not None or payload.get("file_ids") is not None

Type guard

def is_seed_inspect_payload(p: dict) -> bool:
    return ("content_base64" in p) != ("file_ids" in p) and ("content_base64" in p or "file_ids" in p)

Prevention

When it happens

Trigger: POSTing to the seed-inspect endpoint with neither 'content_base64' nor 'file_ids' in the JSON body, e.g. only optional fields like preview_size/seed_source_type, or a client bug that skips the payload entirely.

Common situations: Frontend form submitted before a file is chosen; serialization bug that drops the data field (e.g. wrong key casing: Content_Base64); API exploration with an empty body.

Related errors


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