HKUDS/DeepTutor · error · ValueError
Math animator config must be an object.
Error message
Math animator config must be an object.
What it means
DocumentTooLargeError raised when the running sum of uncompressed member sizes exceeds _EPUB_MAX_TOTAL_UNCOMPRESSED_BYTES. This is the aggregate zip-bomb guard — many individually-small members whose total expansion is huge.
Source
Thrown at deeptutor/agents/math_animator/request_config.py:24
from pydantic import BaseModel, ConfigDict, Field, ValidationError
class MathAnimatorRequestConfig(BaseModel):
model_config = ConfigDict(extra="forbid")
output_mode: Literal["video", "image"] = "video"
quality: Literal["low", "medium", "high"] = "medium"
style_hint: str = Field(default="", max_length=500)
def validate_math_animator_request_config(
raw_config: dict[str, Any] | None,
) -> MathAnimatorRequestConfig:
if raw_config is None:
return MathAnimatorRequestConfig()
if not isinstance(raw_config, dict):
raise ValueError("Math animator config must be an object.")
try:
return MathAnimatorRequestConfig.model_validate(raw_config)
except ValidationError as exc:
details = "; ".join(
f"{'.'.join(str(part) for part in error['loc'])}: {error['msg']}"
for error in exc.errors()
)
raise ValueError(f"Invalid math animator config: {details}") from exc
__all__ = [
"MathAnimatorRequestConfig",
"validate_math_animator_request_config",
]
View on GitHub (pinned to 3e82f13042)
Solutions
- Re-compress/re-package the EPUB with compressed media (Calibre re-export)
- Reject with a clear message and enforce total-size limits at the upload layer
- If legitimate content, split the book into volumes below the limit
Example fix
// before
text = extract_text_from_bytes(data, filename="bigbook.epub") # raises
// after
subprocess.run(["ebook-convert","bigbook.epub","bigbook2.epub","--compress-images"], check=True)
text = extract_text_from_bytes(Path("bigbook2.epub").read_bytes(), filename="bigbook2.epub") Defensive patterns
Strategy: validation
Validate before calling
import zipfile, io
zf = zipfile.ZipFile(io.BytesIO(data))
total = sum(i.file_size for i in zf.infolist())
if total > 1_000_000_000:
reject(fn, "expanded size too large") Try / catch
except DocumentTooLargeError as e:
if "uncompressed contents" in str(e):
recompress_with_calibre(fn) and retry Prevention
- Enforce aggregate uncompressed-size caps at upload
- Re-export EPUBs with compressed media
When it happens
Trigger: An EPUB with thousands of small members totaling gigabytes uncompressed; crafted expansion bombs with high aggregate ratios.
Common situations: Malicious uploads; legitimately huge textbooks with uncompressed media bundled as many small files.
Related errors
- Rendered {suffix} artifact not found.
- Generated code does not define a renderable Manim Scene clas
- Invalid math animator config: {details}
- Code repair attempt #{attempt + 1} timed out after {int(self
- Rejected archive '{sanitized_filename}': {exc}
AI-assisted analysis of HKUDS/DeepTutor@3e82f13042 (2026-08-27).
Data as JSON: /api/errors/b69a86509909e6bb.
Report an issue: GitHub.