HKUDS/DeepTutor · error · ManimRenderError

Render failed because local LaTeX is missing. Please avoid T

Error message

Render failed because local LaTeX is missing. Please avoid Tex/MathTex in generated code or install a LaTeX distribution.

What it means

Plain ValueError raised by validate_upload_safety when file_size exceeds DocumentValidator.MAX_FILE_SIZE. It is the upload-boundary guard (before any parsing) with an explicit limit stated in the message.

Source

Thrown at deeptutor/agents/math_animator/retry_manager.py:131

                                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 exc
                if attempt >= self.max_retries:
                    raise
                retry_attempt = RetryAttempt(attempt=attempt + 1, error=str(exc))
                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}.")
                try:
                    repaired = await asyncio.wait_for(
                        self.repair_callback(code, str(exc), attempt + 1),
                        timeout=self.repair_timeout_seconds,
                    )
                except asyncio.TimeoutError as timeout_exc:
                    raise ManimRenderError(

View on GitHub (pinned to 3e82f13042)

Solutions

  1. Compress or split the file below MAX_FILE_SIZE before upload
  2. Enforce the same limit client-side so users get immediate feedback
  3. If your deployment genuinely needs bigger files, review/raise DocumentValidator.MAX_FILE_SIZE understanding the memory/security implications

Example fix

// before
validate_upload_safety("big.pdf", file_size=10**10)  # raises

// after
if file_size > DocumentValidator.MAX_FILE_SIZE:
    return error_response("file too large, please split or compress")
validate_upload_safety("big.pdf", file_size=file_size)
Defensive patterns

Strategy: validation

Validate before calling

from deeptutor.utils.document_validator import DocumentValidator

if file_size is not None and file_size > DocumentValidator.MAX_FILE_SIZE:
    return error(f"file exceeds {DocumentValidator.MAX_FILE_SIZE} bytes")
validate_upload_safety(filename, file_size=file_size)

Try / catch

try:
    validate_upload_safety(filename, file_size=file_size)
except ValueError as e:
    if str(e).startswith("File too large"):
        return http_400(str(e))

Prevention

When it happens

Trigger: Uploading a file larger than DocumentValidator.MAX_FILE_SIZE to endpoints that call _save_uploaded_files / _validate_upload_batch, websocket_mimic_generate, or safe_extract_zip with file_size provided.

Common situations: Users ingesting large textbooks/videos; misconfigured client not enforcing limits; proxy already streaming a huge body to the handler.

Related errors


AI-assisted analysis of HKUDS/DeepTutor@3e82f13042 (2026-08-27). Data as JSON: /api/errors/5eb94280661626d7. Report an issue: GitHub.