{"record":{"id":"12ba037993533f33","repo":"unslothai/unsloth","slug":"dataset-streaming-streams-from-the-hub-and-cannot","errorCode":null,"errorMessage":"dataset_streaming streams from the Hub and cannot use the local dataset cache; disable streaming to train from the cached copy.","messagePattern":"dataset_streaming streams from the Hub and cannot use the local dataset cache; disable streaming to train from the cached copy\\.","errorType":"http","errorClass":"HTTPException","httpStatus":422,"severity":"warning","filePath":"studio/backend/routes/training.py","lineNumber":1382,"sourceCode":"            # S3 config, since those sources cannot be streamed via HF's loader.\n            if request.local_datasets:\n                raise HTTPException(\n                    status_code = 400,\n                    detail = (\n                        \"dataset_streaming is HF-only; remove local_datasets / S3 source. \"\n                        \"Streaming is not supported with local file paths.\"\n                    ),\n                )\n            if request.s3_config is not None:\n                raise HTTPException(\n                    status_code = 400,\n                    detail = (\n                        \"dataset_streaming is HF-only; remove local_datasets / S3 source. \"\n                        \"Streaming is not supported with S3 datasets.\"\n                    ),\n                )\n            if request.dataset_known_cached or request.dataset_local_path:\n                raise HTTPException(\n                    status_code = 422,\n                    detail = (\n                        \"dataset_streaming streams from the Hub and cannot use the local \"\n                        \"dataset cache; disable streaming to train from the cached copy.\"\n                    ),\n                )\n        model_preflight = await asyncio.to_thread(\n            _reject_untrainable_model_request,\n            request,\n            resume_actual_model_repo_id,\n        )\n        cached_model_pin = model_preflight.cached_model_pin\n        training_actual_model_repo_id = resume_actual_model_repo_id\n        training_model_snapshot_path = request.model_snapshot_path\n        if cached_model_pin is not None:\n            training_actual_model_repo_id, training_model_snapshot_path = cached_model_pin\n\n        if request.hf_dataset:","sourceCodeStart":1364,"sourceCodeEnd":1400,"githubUrl":"https://github.com/unslothai/unsloth/blob/203007d19051dcd2ae33876786d117c99f6b0368/studio/backend/routes/training.py#L1364-L1400","documentation":"Raised (HTTP 422) by the training-start route when the request enables dataset_streaming while also signaling a local dataset source: dataset_known_cached=true or a dataset_local_path. Streaming in HF datasets pulls shards directly from the Hub, so a local cache/path source and streaming are mutually exclusive by design. The route rejects the combination before any training subprocess is spawned.","triggerScenarios":"POST to the training-start endpoint with dataset_streaming=true AND either dataset_known_cached=true or dataset_local_path set (and no local_datasets/S3 source, which would already fail the earlier 400 checks).","commonSituations":"A UI or client that remembers a previously cached dataset and then the user toggles 'stream from Hub'; scripts that set every field defensively; copying a request body from a cached-run template and only flipping the streaming flag.","solutions":["Set dataset_streaming=false to train from the cached/local copy.","Or clear dataset_known_cached and dataset_local_path (and local_datasets/s3_config) so the streaming run sources purely from the Hub.","If you build request payloads programmatically, derive streaming from the source type instead of an independent toggle."],"exampleFix":"// before\n{\n  \"dataset_streaming\": true,\n  \"dataset_known_cached\": true,\n  \"dataset_local_path\": \"/data/cache/my-ds\"\n}\n// after (train from the local copy)\n{\n  \"dataset_streaming\": false,\n  \"dataset_known_cached\": true,\n  \"dataset_local_path\": \"/data/cache/my-ds\"\n}\n// after (stream from the Hub)\n{\n  \"dataset_streaming\": true,\n  \"dataset_known_cached\": false,\n  \"dataset_local_path\": null\n}","handlingStrategy":"validation","validationCode":"function assertStreamingCompatible(req) {\n  if (req.dataset_streaming) {\n    const localSources = [\n      req.dataset_known_cached,\n      req.dataset_local_path,\n      req.dataset_local_datasets,\n      req.s3_config,\n    ].some(Boolean);\n    if (localSources) throw new Error(\n      'dataset_streaming is Hub-only; clear local cache/path/S3 sources or disable streaming'\n    );\n  }\n}","typeGuard":null,"tryCatchPattern":"try { await post('/training/start', payload) } catch (e) { if (e.status === 422 && /dataset_streaming/.test(e.detail)) { payload.dataset_streaming = false; await post('/training/start', payload) } else throw e }","preventionTips":["Derive dataset_streaming from the dataset source type instead of an independent toggle.","Treat cached/local dataset and streaming as mutually exclusive radio options in the UI."],"tags":["huggingface","datasets","streaming","validation","http-422"],"backgroundTag":null,"analyzedSha":"203007d19051dcd2ae33876786d117c99f6b0368","analyzedAt":"2026-08-15T02:48:39.846Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}