unslothai/unsloth · error · HTTPException

Total upload limit ({UNSTRUCTURED_RECIPE_UPLOAD_TOTAL_MAX_LA

Error message

Total upload limit ({UNSTRUCTURED_RECIPE_UPLOAD_TOTAL_MAX_LABEL}) exceeded

What it means

HTTP 413 raised by POST /seed/upload-unstructured-file when the sum of existing files in the block directory (via _get_block_total_size) plus the new upload would exceed UNSTRUCTURED_RECIPE_UPLOAD_TOTAL_MAX_BYTES. This is a per-block aggregate quota, separate from the per-file cap.

Source

Thrown at studio/backend/routes/data_recipe/seed.py:466

        )

    content = await file.read()
    size_bytes = len(content)

    if size_bytes == 0:
        raise HTTPException(400, "Empty file not allowed")

    if size_bytes > UNSTRUCTURED_RECIPE_UPLOAD_MAX_BYTES:
        raise HTTPException(
            413,
            f"File too large ({size_bytes} bytes). Maximum is {UNSTRUCTURED_RECIPE_UPLOAD_MAX_LABEL}.",
        )

    block_dir = UNSTRUCTURED_UPLOAD_ROOT / block_id
    ensure_dir(block_dir)
    current_total = _get_block_total_size(block_dir)
    if current_total + size_bytes > UNSTRUCTURED_RECIPE_UPLOAD_TOTAL_MAX_BYTES:
        raise HTTPException(
            413,
            f"Total upload limit ({UNSTRUCTURED_RECIPE_UPLOAD_TOTAL_MAX_LABEL}) exceeded",
        )

    file_id = uuid4().hex
    raw_path = block_dir / f"{file_id}{ext}"
    raw_path.write_bytes(content)

    extracted_path = block_dir / f"{file_id}.extracted.txt"
    try:
        extracted_text = _extract_text_from_file(raw_path, ext)
        if not extracted_text or not extracted_text.strip():
            raw_path.unlink(missing_ok = True)
            return UnstructuredFileUploadResponse(
                file_id = file_id,
                filename = original_filename,
                size_bytes = size_bytes,
                status = "error",

View on GitHub (pinned to 203007d190)

Solutions

  1. Free space: DELETE /seed/unstructured-file/{block_id}/{file_id} for files no longer needed, or DELETE /seed/unstructured-block/{block_id} to purge a uid-namespaced block.
  2. Move excess documents into a second block rather than exceeding one block's quota.
  3. Shrink/compress remaining files to fit under the total cap.

Example fix

# before
upload(block_id='abc...', file=extra.pdf)  # total would exceed cap

# after
await deleteFile(blockId, unusedFileId);  # free quota first
upload(block_id='abc...', file=extra.pdf);
Defensive patterns

Strategy: validation

Validate before calling

const blockTotal = await getBlockTotalSize(blockId); // from block listing
if (blockTotal + file.size > TOTAL_MAX) throw new Error(`block quota would exceed ${TOTAL_MAX}; delete files first`);

Try / catch

On 413 'Total upload limit exceeded', offer the user a file-picker to delete existing block files, then retry the upload of only the needed files.

Prevention

When it happens

Trigger: Uploading a file to block_id X when files already uploaded to that block total near the aggregate limit; the new file pushes current_total + size_bytes over the cap.

Common situations: Iteratively adding documents to the same block during recipe editing; orphaned uploads from deleted blocks still counting toward quota (docstring notes files on disk still count); users not realizing the quota is cumulative per block.

Related errors


AI-assisted analysis of unslothai/unsloth@203007d190 (2026-08-15). Data as JSON: /api/errors/50cd4837acb2cb82. Report an issue: GitHub.