HKUDS/DeepTutor · error · MinerUError
MinerU archive exceeds the size limit.
Error message
MinerU archive exceeds the size limit.
What it means
Raised by _extract_archive when the cumulative uncompressed size of members extracted from a MinerU-result zip exceeds _MAX_TOTAL_BYTES. It is a defensive guard against zip bombs served by the MinerU cloud API. Extraction is aborted mid-stream.
Source
Thrown at deeptutor/services/parsing/engines/mineru/cloud.py:347
total = 0
try:
with zipfile.ZipFile(io.BytesIO(archive_bytes)) as archive:
members = [m for m in archive.infolist() if not m.is_dir()]
if len(members) > _MAX_ENTRIES:
raise MinerUError(f"MinerU archive has too many entries ({len(members)}).")
for member in members:
# Collapse to a POSIX-relative path and reject traversal.
rel = Path(member.filename.replace("\\", "/"))
if rel.is_absolute() or ".." in rel.parts:
logger.warning("Skipping unsafe zip member: %s", member.filename)
continue
dest = (target_root / rel).resolve()
if target_root not in dest.parents and dest != target_root:
logger.warning("Skipping zip member escaping root: %s", member.filename)
continue
total += member.file_size
if total > _MAX_TOTAL_BYTES:
raise MinerUError("MinerU archive exceeds the size limit.")
dest.parent.mkdir(parents=True, exist_ok=True)
with archive.open(member) as src, open(dest, "wb") as out:
out.write(src.read())
except zipfile.BadZipFile as exc:
raise MinerUError(f"MinerU returned an invalid archive: {exc}") from exc
__all__ = ["parse_cloud", "verify_credentials"]
View on GitHub (pinned to 3e82f13042)
Solutions
- Increase _MAX_TOTAL_BYTES if your documents legitimately produce larger archives
- Check the MinerU job output size (e.g. disable image extraction / lower DPI) before downloading
- Inspect the archive manually (unzip -l) to confirm whether the size is legitimate or a bomb
- If malicious input is suspected, reject the document and re-run the MinerU job
Example fix
// before _MAX_TOTAL_BYTES = 256 * 1024 * 1024 // after (if large scans are expected) _MAX_TOTAL_BYTES = 512 * 1024 * 1024
Defensive patterns
Strategy: validation
Validate before calling
import zipfile
def archive_total_size_ok(path, limit=_MAX_TOTAL_BYTES) -> bool:
with zipfile.ZipFile(path) as z:
return sum(i.file_size for i in z.infolist()) <= limit Try / catch
try:
parse_cloud(...)
except MinerUError as e:
if 'size limit' in str(e): reduce_image_quality_and_retry()
else: raise Prevention
- Pre-check the uncompressed archive size before extraction
- Cap requested image DPI/quality in the MinerU job config
When it happens
Trigger: Calling parse_cloud on a document whose returned archive's summed member.file_size values exceed _MAX_TOTAL_BYTES (accumulated in `total` during iteration); also exercised directly by test_extract_archive_rejects_zip_slip-style tests with oversized fixtures.
Common situations: A malicious or corrupted result archive from the MinerU cloud service (zip bomb), very large scanned documents with many high-resolution images, or a stale _MAX_TOTAL_BYTES constant after a MinerU API change.
Related errors
- Rejected archive '{sanitized_filename}': {exc}
- MinerU archive has too many entries ({len(members)}).
- Rendered {suffix} artifact not found.
- Generated code does not define a renderable Manim Scene clas
- Math animator config must be an object.
AI-assisted analysis of HKUDS/DeepTutor@3e82f13042 (2026-08-27).
Data as JSON: /api/errors/da79f5280b72a63c.
Report an issue: GitHub.