HKUDS/DeepTutor · error · HTTPException
{filename} exceeds the {MAX_MATERIAL_BYTES // (1024 * 1024)}
Error message
{filename} exceeds the {MAX_MATERIAL_BYTES // (1024 * 1024)} MB limit. What it means
Error "{filename} exceeds the {MAX_MATERIAL_BYTES // (1024 * 1024)} MB limit." thrown in HKUDS/DeepTutor.
Source
Thrown at deeptutor/api/routers/reading.py:193
async def upload_material(file: UploadFile = File(...)) -> MaterialDetail: # noqa: B008
"""Ingest an uploaded document and return it ready to read.
The upload is streamed to a temp file with a running size check, so an
oversized file is rejected before it is fully buffered rather than after.
"""
filename = (file.filename or "").strip()
if not filename:
raise HTTPException(status_code=400, detail="The upload has no filename.")
tmp_dir = Path(tempfile.mkdtemp(prefix="dt-reading-"))
tmp_path = tmp_dir / Path(filename).name
written = 0
try:
with tmp_path.open("wb") as sink:
while chunk := await file.read(_UPLOAD_CHUNK):
written += len(chunk)
if written > MAX_MATERIAL_BYTES:
raise HTTPException(
status_code=413,
detail=(
f"{filename} exceeds the "
f"{MAX_MATERIAL_BYTES // (1024 * 1024)} MB limit."
),
)
sink.write(chunk)
if written == 0:
raise HTTPException(status_code=400, detail=f"{filename} is empty.")
store = _store()
manifest = store.ingest(tmp_path, filename=filename)
return _detail(store, manifest)
except HTTPException:
raise
except Exception as exc:
raise _http_error(exc) from exc
finally:View on GitHub (pinned to 3e82f13042)
When it happens
Trigger: Thrown at deeptutor/api/routers/reading.py:193 when the library encounters an invalid state.
Common situations: See trigger scenarios.
AI-assisted analysis of HKUDS/DeepTutor@3e82f13042 (2026-08-27).
Data as JSON: /api/errors/ec94479c692c1fbe.
Report an issue: GitHub.