HKUDS/DeepTutor · error · ManimRenderError
Code repair attempt #{attempt + 1} timed out after {int(self
Error message
Code repair attempt #{attempt + 1} timed out after {int(self.repair_timeout_seconds)}s. What it means
Raised by _parse_xml_member when DefusedElementTree.fromstring fails on an OOXML/EPUB XML member (ParseError or defusedxml exception). The member name and parse error are included; the exception is chained. This indicates malformed or unsafe XML inside an otherwise valid zip package.
Source
Thrown at deeptutor/agents/math_animator/retry_manager.py:116
if review_result.suggested_fix
else ""
)
),
)
retry_history.append(retry_attempt)
if self.on_retry is not None:
await self.on_retry(retry_attempt)
if self.on_status is not None:
await self.on_status(
f"Generating repaired code for retry #{attempt + 1} from visual review feedback."
)
try:
repaired = await asyncio.wait_for(
self.repair_callback(code, retry_attempt.error, attempt + 1),
timeout=self.repair_timeout_seconds,
)
except asyncio.TimeoutError as timeout_exc:
raise ManimRenderError(
f"Code repair attempt #{attempt + 1} timed out after "
f"{int(self.repair_timeout_seconds)}s."
) from timeout_exc
code = repaired.code.strip() or code
if self.on_status is not None:
await self.on_status(
f"Retry #{attempt + 1} code generated from visual review. Re-rendering now."
)
continue
render_result.retry_attempts = len(retry_history)
render_result.retry_history = retry_history
return code, render_result
except ManimRenderError as exc:
if _is_non_retriable_environment_error(str(exc)):
raise ManimRenderError(
"Render failed because local LaTeX is missing. "
"Please avoid Tex/MathTex in generated code or install a LaTeX distribution."
) from excView on GitHub (pinned to 3e82f13042)
Solutions
- Re-save the document from its native application to regenerate clean XML
- If defusedxml rejected entity expansion, treat the file as untrusted and quarantine it
- Skip the unparseable member: call the reader-of-member APIs that return None on KeyError-style absence instead of full-file abort
Example fix
// before
root = _parse_xml_member(zf, "word/document.xml", "bad.docx") # raises
// after
from deeptutor.utils.document_extractor import CorruptDocumentError
try:
root = _parse_xml_member(zf, "word/document.xml", "bad.docx")
except CorruptDocumentError:
root = None # degrade gracefully, skip member Defensive patterns
Strategy: try-catch
Validate before calling
# pre-validate with a lenient parser is usually overkill; prefer member-level skip pass
Try / catch
from deeptutor.utils.document_extractor import CorruptDocumentError
except CorruptDocumentError as e:
if "failed to parse" in str(e):
log.warning("skipping bad XML member", error=e)
# continue extraction without that member Prevention
- Re-save documents from native apps to fix malformed XML
- Treat defusedxml rejections as a sign of hostile content
When it happens
Trigger: A DOCX/XLSX/PPTX/EPUB zip containing a member whose XML is truncated, invalid, or contains entity-expansion attacks (defusedxml rejects those explicitly).
Common situations: Half-written Office files from crashed saves; hand-edited OOXML; XXE/billion-laughs payloads aimed at XML parsers.
Understand the failure class
- Timeouts: ETIMEDOUT, deadlines, and hung requests — what actually expires when a request times out.
Related errors
- Rendered {suffix} artifact not found.
- Generated code does not define a renderable Manim Scene clas
- Math animator config must be an object.
- Invalid math animator config: {details}
- Visual quality review timed out after {int(self.review_timeo
AI-assisted analysis of HKUDS/DeepTutor@3e82f13042 (2026-08-27).
Data as JSON: /api/errors/7e912f5fe08bf423.
Report an issue: GitHub.