unslothai/unsloth · error · HTTPException
file too large (max {LOCAL_SEED_UPLOAD_MAX_LABEL})
Error message
file too large (max {LOCAL_SEED_UPLOAD_MAX_LABEL}) What it means
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.
Source
Thrown at studio/backend/routes/data_recipe/seed.py:673
if ext not in _LEGACY_UNSTRUCTURED_EXTS:
allowed = ", ".join(sorted(_LEGACY_UNSTRUCTURED_EXTS))
raise HTTPException(
status_code = 400,
detail = f"unsupported file type: {ext}. allowed: {allowed}",
)
else:
if ext not in LOCAL_UPLOAD_EXTS:
allowed = ", ".join(sorted(LOCAL_UPLOAD_EXTS))
raise HTTPException(
status_code = 400,
detail = f"unsupported file type: {ext}. allowed: {allowed}",
)
file_bytes = _decode_base64_payload(payload.content_base64)
if not file_bytes:
raise HTTPException(status_code = 400, detail = "empty upload payload")
if len(file_bytes) > LOCAL_SEED_UPLOAD_MAX_BYTES:
raise HTTPException(
status_code = 413,
detail = f"file too large (max {LOCAL_SEED_UPLOAD_MAX_LABEL})",
)
ensure_dir(SEED_UPLOAD_DIR)
stored_name = f"{uuid4().hex}_{filename}"
stored_path = SEED_UPLOAD_DIR / stored_name
stored_path.write_bytes(file_bytes)
if seed_source_type == "unstructured":
preview_rows = _read_preview_rows_from_unstructured_file(
path = stored_path,
preview_size = int(payload.preview_size),
chunk_size = payload.unstructured_chunk_size,
chunk_overlap = payload.unstructured_chunk_overlap,
)
else:
preview_rows = _read_preview_rows_from_local_file(View on GitHub (pinned to 203007d190)
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.
Example fix
// before const b64 = await fileToBase64(hugeCsv); // 500MB file // after const head = await readFirstNRows(hugeCsv, 1000); const b64 = await fileToBase64(head);
Defensive patterns
Strategy: validation
Validate before calling
const MAX = LOCAL_SEED_UPLOAD_MAX_BYTES; // mirror server constant
if (file.size > MAX) {
file = await truncateToPreview(file, MAX);
} Prevention
- 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.
When it happens
Trigger: 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.
Common situations: 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.
Related errors
- File exceeds the {cap // (1024 * 1024)} MB upload limit.
- VirusTotal upload failed after {attempts} attempt(s): {last_
- each reference image must be at most 32 MiB (base64)
- each reference must be at most 32 MiB (base64)
- File too large ({size_bytes} bytes). Maximum is {UNSTRUCTURE
AI-assisted analysis of unslothai/unsloth@203007d190 (2026-08-15).
Data as JSON: /api/errors/db9582d04afa4d92.
Report an issue: GitHub.