unslothai/unsloth · warning · ValueError
file_ids must not be empty
Error message
file_ids must not be empty
What it means
Pydantic model_validator error on SeedInspectUploadRequest when the multi-file mode is selected (file_ids present) but the list is empty. An empty upload has nothing to inspect, and distinguishing it here yields a clearer 422 than a downstream 'no files resolved' failure.
Source
Thrown at studio/backend/models/data_recipe.py:100
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)
split: str | None = None
subset: str | None = None
resolved_paths: list[str] | None = NoneView on GitHub (pinned to 203007d190)
Solutions
- Ensure file_ids contains at least one previously uploaded file id before calling the endpoint.
- Disable the submit action in the UI until the selection is non-empty.
- If the array is built dynamically, log its length right before the request to catch filter bugs.
Example fix
// before
{ "file_ids": [], "file_names": [], "block_id": "b1" }
// after
{ "file_ids": ["file-123"], "file_names": ["a.jsonl"], "block_id": "b1" } Defensive patterns
Strategy: validation
Validate before calling
def file_ids_valid(file_ids: list[str] | None) -> bool:
return file_ids is None or len(file_ids) > 0 Type guard
def is_nonempty_id_list(v: list[str] | None) -> bool:
return v is None or (isinstance(v, list) and len(v) > 0) Prevention
- Guard the submit handler: if not fileIds.length, disable the button.
- After filtering/dedupe steps, assert the array is still non-empty.
- Log array length immediately before the request to catch state bugs.
When it happens
Trigger: POSTing {"file_ids": [], ...} — typically a client that initializes an empty selection array and submits before any files are picked, or a filter that removes all ids.
Common situations: UI allowing submit with zero selected files; a dedupe/filter step that empties the array; state reset bugs that clear the list but not the submit flag.
Related errors
- Provide either content_base64 or file_ids, not both
- Provide either content_base64 or file_ids
- block_id is required when using file_ids
- file_names must be provided and same length as file_ids
- filename is required when using content_base64
AI-assisted analysis of unslothai/unsloth@203007d190 (2026-08-15).
Data as JSON: /api/errors/829f4650b0906d45.
Report an issue: GitHub.