{"record":{"id":"292db2dc389683d9","repo":"HKUDS/DeepTutor","slug":"visualreviewagent-prompts-are-not-configured","errorCode":null,"errorMessage":"VisualReviewAgent prompts are not configured.","messagePattern":"VisualReviewAgent prompts are not configured\\.","errorType":"validation","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"deeptutor/agents/math_animator/agents/visual_review_agent.py","lineNumber":60,"sourceCode":"        if not attachments:\n            return VisualReviewResult(\n                passed=True,\n                summary=\"Visual review skipped because no review frames were available.\",\n                reviewed_frames=0,\n            )\n\n        model = self.get_model()\n        if not supports_vision(self.binding, model):\n            return VisualReviewResult(\n                passed=True,\n                summary=\"Visual review skipped because the current model does not support image inspection.\",\n                reviewed_frames=len(attachments),\n            )\n\n        system_prompt = self.get_prompt(\"system\")\n        user_template = self.get_prompt(\"user_template\")\n        if not system_prompt or not user_template:\n            raise ValueError(\"VisualReviewAgent prompts are not configured.\")\n\n        user_prompt = user_template.format(\n            user_input=user_input.strip(),\n            output_mode=output_mode,\n            reviewed_frames=len(attachments),\n            render_json=json.dumps(\n                render_result.model_dump(exclude={\"visual_review\"}), ensure_ascii=False, indent=2\n            ),\n            current_code=current_code,\n        )\n        messages = [\n            {\"role\": \"system\", \"content\": system_prompt},\n            {\"role\": \"user\", \"content\": user_prompt},\n        ]\n        _chunks: list[str] = []\n        async for _c in self.stream_llm(\n            user_prompt=user_prompt,\n            system_prompt=system_prompt,","sourceCodeStart":42,"sourceCodeEnd":78,"githubUrl":"https://github.com/HKUDS/DeepTutor/blob/3e82f130422a813cdd73c10b21a44e9325f5821a/deeptutor/agents/math_animator/agents/visual_review_agent.py#L42-L78","documentation":"Raised by _extract_docx when python-docx raised while opening the file (primary_error), the OOXML fallback yielded no text, so the original open failure is re-raised wrapped as CorruptDocumentError. Typical cause: the bytes are not a valid DOCX (OOXML) package despite the extension.","triggerScenarios":"A .doc renamed to .docx (legacy OLE2 format); a truncated or non-zip file with a .docx extension; a Word file with a corrupt contentTypes.xml that python-docx rejects but that contains no recoverable text either.","commonSituations":"Users renaming old .doc files; partially uploaded files; documents saved by non-conforming generators.","solutions":["Convert genuine legacy .doc files with LibreOffice (soffice --convert-to docx) before ingestion","Detect OLE2 magic bytes and route to a legacy-format handler","Re-save the document from Word to repair structure, then retry"],"exampleFix":"// before\ntext = extract_text_from_bytes(data, filename=\"old.docx\")  # actually OLE2 .doc\n\n// after\nsubprocess.run([\"soffice\",\"--headless\",\"--convert-to\",\"docx\",\"old.doc\"], check=True)\ntext = extract_text_from_bytes(Path(\"old.docx\").read_bytes(), filename=\"old.docx\")","handlingStrategy":"validation","validationCode":"def is_ooxml(data: bytes) -> bool:\n    return data[:2] == b\"PK\"\n\nif not is_ooxml(data):\n    route_to_legacy_converter(fn)","typeGuard":null,"tryCatchPattern":"except CorruptDocumentError as e:\n    if \"failed to open DOCX\" in str(e):\n        convert_with_libreoffice(fn) and retry","preventionTips":["Magic-byte check before parsing","Convert legacy .doc via LibreOffice at ingest"],"tags":["docx","corruption","legacy-format","document-extraction"],"backgroundTag":"corrupt-docx-parse","analyzedSha":"3e82f130422a813cdd73c10b21a44e9325f5821a","analyzedAt":"2026-08-27T06:57:25.364Z","schemaVersion":2},"datasetVersion":"2026-08-27T08:17:20.692Z"}