HKUDS/DeepTutor · warning · HTTPException
Rejected archive '{sanitized_filename}': {exc}
Error message
Rejected archive '{sanitized_filename}': {exc} What it means
400 raised by _save_zip_archive when safe_extract_zip throws ArchiveTooLargeError — the archive passed the raw size check but its decompressed contents exceed the extraction budget (zip-bomb / oversized-content protection).
Source
Thrown at deeptutor/api/routers/knowledge.py:285
written = 0
for chunk in iter(lambda: file.file.read(8192), b""):
written += len(chunk)
if written > max_size:
raise HTTPException(
status_code=400,
detail=(
f"Archive '{sanitized_filename}' exceeds maximum size limit of "
f"{format_bytes_human_readable(max_size)}"
),
)
tmp.write(chunk)
try:
result = safe_extract_zip(
tmp_path, target_dir, allowed_extensions=allowed_extensions or set()
)
except ArchiveTooLargeError as exc:
raise HTTPException(
status_code=400,
detail=f"Rejected archive '{sanitized_filename}': {exc}",
) from exc
except zipfile.BadZipFile as exc:
raise HTTPException(
status_code=400,
detail=f"'{sanitized_filename}' is not a valid zip archive.",
) from exc
if not result.extracted:
raise HTTPException(
status_code=400,
detail=f"Archive '{sanitized_filename}' contained no supported files.",
)
return result.extracted
finally:
if tmp_path is not None:
tmp_path.unlink(missing_ok=True)View on GitHub (pinned to 3e82f13042)
Solutions
- Reduce the decompressed size: remove unnecessary files, split into several archives
- Check the extraction limit config and adjust if the content is legitimate
- Avoid nested zips — extract locally and re-zip flat before upload
Defensive patterns
Strategy: validation
Validate before calling
import zipfile
total = sum(i.file_size for i in zipfile.ZipFile(p).infolist())
if total > MAX_DECOMPRESSED:
raise ValueError('decompressed size too large — remove files or split') Try / catch
resp = upload(zip_path)
if resp.status_code == 400 and 'Rejected archive' in resp.text:
# decompressed content too large; repackage smaller/flatter
repackage(zip_path) Prevention
- Compute decompressed size before uploading
- Avoid nested zips
- Split dense corpora into several archives
When it happens
Trigger: Uploading a zip that is small on disk but expands beyond the extraction limit (highly compressed data, nested archives), or contains more files/bytes than allowed.
Common situations: Zips of dense text corpora, nested zips, or a lowered extraction budget in config; benign large datasets mistaken for zip bombs.
Related errors
- Archive '{sanitized_filename}' exceeds maximum size limit of
- '{sanitized_filename}' is not a valid zip archive.
- Archive '{sanitized_filename}' contained no supported files.
- File '{sanitized_filename}' exceeds maximum size limit of {s
- MinerU archive has too many entries ({len(members)}).
AI-assisted analysis of HKUDS/DeepTutor@3e82f13042 (2026-08-27).
Data as JSON: /api/errors/199fee097839b4f5.
Report an issue: GitHub.