{"record":{"id":"95a054e3112fc2f1","repo":"unslothai/unsloth","slug":"subset-is-too-long-max-max-hf-dataset-option-len","errorCode":null,"errorMessage":"subset is too long (max {MAX_HF_DATASET_OPTION_LENGTH} chars)","messagePattern":"subset is too long \\(max (.+?) chars\\)","errorType":"validation","errorClass":"ValueError","httpStatus":422,"severity":"error","filePath":"studio/backend/models/training.py","lineNumber":249,"sourceCode":"            return None\n        if len(v) > 256:\n            raise ValueError(\"hf_dataset is too long (max 256 chars)\")\n        if \"..\" in v:\n            raise ValueError(\"hf_dataset must not contain '..'\")\n        if any(_HF_DATASET_ID_SEGMENT_RE.fullmatch(segment) is None for segment in v.split(\"/\")):\n            raise ValueError(\"hf_dataset contains invalid characters or path segments\")\n        return v\n\n    @field_validator(\"subset\")\n    @classmethod\n    def _check_subset(cls, v: Optional[str]) -> Optional[str]:\n        if v is None:\n            return v\n        v = v.strip()\n        if not v:\n            return None\n        if len(v) > MAX_HF_DATASET_OPTION_LENGTH:\n            raise ValueError(f\"subset is too long (max {MAX_HF_DATASET_OPTION_LENGTH} chars)\")\n        if not valid_hf_dataset_config_name(v):\n            raise ValueError(\"subset contains invalid characters\")\n        return v\n\n    @field_validator(\n        \"model_local_path\",\n        \"dataset_local_path\",\n        \"model_snapshot_path\",\n        \"dataset_snapshot_path\",\n    )\n    @classmethod\n    def _check_cache_local_path(cls, v: Optional[str]) -> Optional[str]:\n        if v is None:\n            return v\n        v = v.strip()\n        if not v:\n            return None\n        if len(v) > 4096:","sourceCodeStart":231,"sourceCodeEnd":267,"githubUrl":"https://github.com/unslothai/unsloth/blob/203007d19051dcd2ae33876786d117c99f6b0368/studio/backend/models/training.py#L231-L267","documentation":"Raised by the _check_subset field validator on TrainingStartRequest: the optional dataset subset/config name is capped at MAX_HF_DATASET_OPTION_LENGTH characters after trimming (empty-after-trim normalizes to None). Subsets are short identifiers like 'default' or 'plain_text', so an over-long value signals a pasted blob or wrong field mapping. It fires before the character-validity check.","triggerScenarios":"POST a training start request with a subset string longer than the configured max (MAX_HF_DATASET_OPTION_LENGTH), e.g. a full config JSON accidentally placed in subset.","commonSituations":"Mapping the wrong config field (e.g. training args JSON) into subset; pasting a dataset README; a UI text-area instead of a short input bound to subset.","solutions":["Send the short subset/config name only, e.g. 'default'.","Check your request mapping: long config blobs belong elsewhere, not in subset.","Omit subset entirely (it normalizes to None) if the dataset has a single config."],"exampleFix":"// before\n{ hf_dataset: \"user/data\", subset: JSON.stringify(config) }\n// after\n{ hf_dataset: \"user/data\", subset: \"default\" }","handlingStrategy":"validation","validationCode":"def subset_short_enough(body: dict, max_len: int) -> bool:\n    v = (body.get(\"subset\") or \"\").strip()\n    return len(v) <= max_len","typeGuard":"function subsetOk(subset: string | undefined, maxLen: number): boolean {\n  return (subset?.trim().length ?? 0) <= maxLen;\n}","tryCatchPattern":null,"preventionTips":["Use a short text input for subset, not a text area","Fetch the dataset's real config list from the HF API and use a dropdown"],"tags":["pydantic","validation","training","huggingface","dataset","subset"],"backgroundTag":null,"analyzedSha":"203007d19051dcd2ae33876786d117c99f6b0368","analyzedAt":"2026-08-15T02:48:39.846Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}