{"record":{"id":"c4dca6c8a012ce5e","repo":"unslothai/unsloth","slug":"filename-is-required-when-using-content-base64","errorCode":null,"errorMessage":"filename is required when using content_base64","messagePattern":"filename is required when using content_base64","errorType":"validation","errorClass":"ValueError","httpStatus":null,"severity":"warning","filePath":"studio/backend/models/data_recipe.py","lineNumber":107,"sourceCode":"\n    @model_validator(mode = \"after\")\n    def _check_mutual_exclusivity(self) -> \"SeedInspectUploadRequest\":\n        has_legacy = self.content_base64 is not None\n        has_multi = self.file_ids is not None\n        if has_legacy and has_multi:\n            raise ValueError(\"Provide either content_base64 or file_ids, not both\")\n        if not has_legacy and not has_multi:\n            raise ValueError(\"Provide either content_base64 or file_ids\")\n        if has_multi:\n            if len(self.file_ids) == 0:\n                raise ValueError(\"file_ids must not be empty\")\n            if not self.block_id:\n                raise ValueError(\"block_id is required when using file_ids\")\n            if self.file_names is None or len(self.file_ids) != len(self.file_names):\n                raise ValueError(\"file_names must be provided and same length as file_ids\")\n        if has_legacy:\n            if not self.filename:\n                raise ValueError(\"filename is required when using content_base64\")\n        return self\n\n\nclass SeedInspectResponse(BaseModel):\n    dataset_name: str\n    resolved_path: str\n    columns: list[str] = Field(default_factory = list)\n    preview_rows: list[dict[str, Any]] = Field(default_factory = list)\n    split: str | None = None\n    subset: str | None = None\n    resolved_paths: list[str] | None = None\n\n\nclass UnstructuredFileUploadResponse(BaseModel):\n    file_id: str\n    filename: str\n    size_bytes: int\n    status: str  # \"ok\" or \"error\"","sourceCodeStart":89,"sourceCodeEnd":125,"githubUrl":"https://github.com/unslothai/unsloth/blob/203007d19051dcd2ae33876786d117c99f6b0368/studio/backend/models/data_recipe.py#L89-L125","documentation":"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.","triggerScenarios":"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.","commonSituations":"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'.","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."],"exampleFix":"// before\n{ \"content_base64\": \"eyJhIjoxfQ==\" }\n// after\n{ \"content_base64\": \"eyJhIjoxfQ==\", \"filename\": \"data.jsonl\" }","handlingStrategy":"validation","validationCode":"def inline_fields_valid(content_base64: str | None, filename: str | None) -> bool:\n    return content_base64 is None or bool(filename and filename.strip())","typeGuard":"def has_filename(p: dict) -> bool:\n    fn = p.get(\"filename\")\n    return isinstance(fn, str) and fn.strip() != \"\"","tryCatchPattern":null,"preventionTips":["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."],"tags":["validation","pydantic","api","http-422","upload"],"backgroundTag":null,"analyzedSha":"203007d19051dcd2ae33876786d117c99f6b0368","analyzedAt":"2026-08-15T02:48:39.846Z","schemaVersion":2},"datasetVersion":"2026-08-15T17:31:12.345Z"}