unslothai/unsloth · warning · ValueError
filename is required when using content_base64
Error message
filename is required when using content_base64
What it means
Pydantic model_validator error on SeedInspectUploadRequest when the legacy inline mode is used (content_base64 present) but filename is not supplied. The backend needs the filename to detect the data format (jsonl/csv/parquet etc.) since inline content has no name of its own.
Source
Thrown at studio/backend/models/data_recipe.py:107
@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 = None
class UnstructuredFileUploadResponse(BaseModel):
file_id: str
filename: str
size_bytes: int
status: str # "ok" or "error"View on GitHub (pinned to 203007d190)
Solutions
- Include 'filename' (exact key, snake-free single word) with the original file name including extension, e.g. 'data.jsonl'.
- If uploading from an in-memory buffer, synthesize a meaningful name with the right extension for format detection.
- Ensure the value is a non-empty string.
Example fix
// before
{ "content_base64": "eyJhIjoxfQ==" }
// after
{ "content_base64": "eyJhIjoxfQ==", "filename": "data.jsonl" } Defensive patterns
Strategy: validation
Validate before calling
def inline_fields_valid(content_base64: str | None, filename: str | None) -> bool:
return content_base64 is None or bool(filename and filename.strip()) Type guard
def has_filename(p: dict) -> bool:
fn = p.get("filename")
return isinstance(fn, str) and fn.strip() != "" Prevention
- Always send the original file name (with extension) alongside inline content.
- For buffer uploads, synthesize 'data.<ext>' so format detection still works.
- Remember the key is 'filename' (no underscore), unlike other multi-word fields.
When it happens
Trigger: POSTing {"content_base64": "..."} with no 'filename' field (or an empty string), e.g. a client that reads file bytes but forgets to include the original name.
Common situations: Client refactor where the file input's name is dropped; programmatic uploads from buffers that have no natural filename; key named 'file_name' instead of 'filename'.
Related errors
- Provide either content_base64 or file_ids, not both
- Provide either content_base64 or file_ids
- file_ids must not be empty
- block_id is required when using file_ids
- file_names must be provided and same length as file_ids
AI-assisted analysis of unslothai/unsloth@203007d190 (2026-08-15).
Data as JSON: /api/errors/c4dca6c8a012ce5e.
Report an issue: GitHub.