{"record":{"id":"db9582d04afa4d92","repo":"unslothai/unsloth","slug":"file-too-large-max-local-seed-upload-max-label","errorCode":null,"errorMessage":"file too large (max {LOCAL_SEED_UPLOAD_MAX_LABEL})","messagePattern":"file too large \\(max (.+?)\\)","errorType":"http","errorClass":"HTTPException","httpStatus":413,"severity":"error","filePath":"studio/backend/routes/data_recipe/seed.py","lineNumber":673,"sourceCode":"        if ext not in _LEGACY_UNSTRUCTURED_EXTS:\n            allowed = \", \".join(sorted(_LEGACY_UNSTRUCTURED_EXTS))\n            raise HTTPException(\n                status_code = 400,\n                detail = f\"unsupported file type: {ext}. allowed: {allowed}\",\n            )\n    else:\n        if ext not in LOCAL_UPLOAD_EXTS:\n            allowed = \", \".join(sorted(LOCAL_UPLOAD_EXTS))\n            raise HTTPException(\n                status_code = 400,\n                detail = f\"unsupported file type: {ext}. allowed: {allowed}\",\n            )\n\n    file_bytes = _decode_base64_payload(payload.content_base64)\n    if not file_bytes:\n        raise HTTPException(status_code = 400, detail = \"empty upload payload\")\n    if len(file_bytes) > LOCAL_SEED_UPLOAD_MAX_BYTES:\n        raise HTTPException(\n            status_code = 413,\n            detail = f\"file too large (max {LOCAL_SEED_UPLOAD_MAX_LABEL})\",\n        )\n\n    ensure_dir(SEED_UPLOAD_DIR)\n    stored_name = f\"{uuid4().hex}_{filename}\"\n    stored_path = SEED_UPLOAD_DIR / stored_name\n    stored_path.write_bytes(file_bytes)\n\n    if seed_source_type == \"unstructured\":\n        preview_rows = _read_preview_rows_from_unstructured_file(\n            path = stored_path,\n            preview_size = int(payload.preview_size),\n            chunk_size = payload.unstructured_chunk_size,\n            chunk_overlap = payload.unstructured_chunk_overlap,\n        )\n    else:\n        preview_rows = _read_preview_rows_from_local_file(","sourceCodeStart":655,"sourceCodeEnd":691,"githubUrl":"https://github.com/unslothai/unsloth/blob/203007d19051dcd2ae33876786d117c99f6b0368/studio/backend/routes/data_recipe/seed.py#L655-L691","documentation":"HTTP 413 raised when the decoded byte length of the uploaded seed file exceeds LOCAL_SEED_UPLOAD_MAX_BYTES. The limit is enforced server-side after base64 decoding and before the file is written to SEED_UPLOAD_DIR, with a human-readable label (LOCAL_SEED_UPLOAD_MAX_LABEL) embedded in the message.","triggerScenarios":"Uploading a structured dataset (csv/json) or text seed larger than the configured cap; the check compares len(file_bytes) against the constant, so both genuinely large files and accidentally duplicated/concatenated payloads trigger it.","commonSituations":"Full-dataset uploads when only a preview sample is needed; a reverse proxy already blocking large bodies with a different error, masking this one; the client sending the raw bytes base64-encoded of a file that grew after a re-export.","solutions":["Sample or truncate the dataset client-side to stay under the limit (a preview only needs the first N rows).","Raise LOCAL_SEED_UPLOAD_MAX_BYTES in backend config if full-file seeding is genuinely required (and raise any upstream proxy body limits to match).","Compress or split the file, or move it onto the server filesystem and reference it by path instead of uploading."],"exampleFix":"// before\nconst b64 = await fileToBase64(hugeCsv); // 500MB file\n\n// after\nconst head = await readFirstNRows(hugeCsv, 1000);\nconst b64 = await fileToBase64(head);","handlingStrategy":"validation","validationCode":"const MAX = LOCAL_SEED_UPLOAD_MAX_BYTES; // mirror server constant\nif (file.size > MAX) {\n  file = await truncateToPreview(file, MAX);\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Upload only a preview sample (first N rows) instead of the full dataset.","Keep client and server size limits in sync, including any reverse-proxy body limits."],"tags":["file-upload","payload-limit","http-413"],"backgroundTag":null,"analyzedSha":"203007d19051dcd2ae33876786d117c99f6b0368","analyzedAt":"2026-08-15T02:48:39.846Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}