{"record":{"id":"2afa11c95bdab073","repo":"unslothai/unsloth","slug":"block-id-is-required-when-using-file-ids","errorCode":null,"errorMessage":"block_id is required when using file_ids","messagePattern":"block_id is required when using file_ids","errorType":"validation","errorClass":"ValueError","httpStatus":null,"severity":"warning","filePath":"studio/backend/models/data_recipe.py","lineNumber":102,"sourceCode":"    # Shared fields\n    preview_size: int = Field(default = 10, ge = 1, le = 50)\n    seed_source_type: str | None = None\n    unstructured_chunk_size: int | None = Field(default = None, ge = 1, le = 20000)\n    unstructured_chunk_overlap: int | None = Field(default = None, ge = 0, le = 20000)\n\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","sourceCodeStart":84,"sourceCodeEnd":120,"githubUrl":"https://github.com/unslothai/unsloth/blob/203007d19051dcd2ae33876786d117c99f6b0368/studio/backend/models/data_recipe.py#L84-L120","documentation":"Pydantic model_validator error on SeedInspectUploadRequest when file_ids is used without block_id. Multi-file uploads are staged under a block (an upload grouping); the inspect endpoint needs the block id to resolve where the files live, unlike the legacy inline mode which carries its own content.","triggerScenarios":"POSTing {\"file_ids\": [...], \"file_names\": [...]} with no 'block_id' key (or block_id: null / empty string), after the files were uploaded through the multi-file block upload flow.","commonSituations":"Client forgets to thread the block id returned by the upload endpoint into the subsequent inspect call; partial refactor from the legacy single-file API; block id stored under a different key name (e.g. 'blockId') in the client.","solutions":["Capture the block id from the multi-file upload response and include it as 'block_id' in the inspect request.","Verify the exact field name is snake_case 'block_id', not 'blockId'.","Ensure block_id is a non-empty string after any trimming."],"exampleFix":"// before\n{ \"file_ids\": [\"f1\"], \"file_names\": [\"a.jsonl\"] }\n// after\n{ \"file_ids\": [\"f1\"], \"file_names\": [\"a.jsonl\"], \"block_id\": \"blk-42\" }","handlingStrategy":"validation","validationCode":"def multi_file_fields_valid(file_ids: list[str] | None, block_id: str | None) -> bool:\n    return file_ids is None or bool(block_id and block_id.strip())","typeGuard":"def has_block_id(p: dict) -> bool:\n    bid = p.get(\"block_id\")\n    return isinstance(bid, str) and bid.strip() != \"\"","tryCatchPattern":null,"preventionTips":["Thread the block id from the upload response into every subsequent inspect/export call.","Use the exact key 'block_id' (snake_case) in payloads.","Store the upload session (block_id + files) as one client-side object so they cannot diverge."],"tags":["validation","pydantic","api","http-422","upload"],"backgroundTag":null,"analyzedSha":"203007d19051dcd2ae33876786d117c99f6b0368","analyzedAt":"2026-08-15T02:48:39.846Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}