{"record":{"id":"3eea7e62675f0187","repo":"docling-project/docling","slug":"mspowerpointdocumentbackend-could-not-load-documen","errorCode":null,"errorMessage":"MsPowerpointDocumentBackend could not load document with hash {self.document_hash}","messagePattern":"MsPowerpointDocumentBackend could not load document with hash (.+?)","errorType":"exception","errorClass":"DocumentLoadError","httpStatus":null,"severity":"error","filePath":"docling/backend/mspowerpoint_backend.py","lineNumber":167,"sourceCode":"        super().__init__(in_doc, path_or_stream, options)\n        self.path_or_stream: Union[BytesIO, Path] = path_or_stream\n        self.page_range = in_doc.limits.page_range\n\n        self.pptx_to_pdf_converter: Optional[Callable] = None\n        self.pptx_to_pdf_converter_init: bool = False\n        self._render_charts: bool = False\n\n        self.pptx_obj: Optional[presentation.Presentation] = None\n        self.valid: bool = False\n        try:\n            if isinstance(self.path_or_stream, BytesIO):\n                self.pptx_obj = Presentation(self.path_or_stream)\n            elif isinstance(self.path_or_stream, Path):\n                self.pptx_obj = Presentation(str(self.path_or_stream))\n\n            self.valid = True\n        except Exception as e:\n            raise DocumentLoadError(\n                f\"MsPowerpointDocumentBackend could not load document with hash {self.document_hash}\"\n            ) from e\n\n        return\n\n    def page_count(self) -> int:\n        if self.is_valid():\n            assert self.pptx_obj is not None\n            return len(self.pptx_obj.slides)\n        else:\n            return 0\n\n    @override\n    def is_valid(self) -> bool:\n        return self.valid\n\n    @classmethod\n    @override","sourceCodeStart":149,"sourceCodeEnd":185,"githubUrl":"https://github.com/docling-project/docling/blob/61d76f1ff3f8428065465889f7b4577da7df704c/docling/backend/mspowerpoint_backend.py#L149-L185","documentation":"DocumentLoadError raised by MsPowerpointDocumentBackend when python-pptx's Presentation() constructor throws on the input. Any exception while opening the file (invalid zip, unreadable presentation.xml, wrong extension content, encrypted file) is wrapped, with valid left False and the openpyxl-style chained cause preserved for diagnosis.","triggerScenarios":"Converting a file that pptx cannot open: .ppt renamed to .pptx without conversion, a .pptx that is actually a PDF/ODP, an Office-encrypted (password) deck, a macro-enabled file python-pptx rejects, or a truncated upload. Also .ppt input when the soffice-based pre-conversion step produced an invalid pptx.","commonSituations":"Upload pipelines receiving mislabeled or password-protected decks, Keynote/Google-Slides exports with quirks, corrupted email attachments, or missing/broken LibreOffice for legacy .ppt.","solutions":["Read e.__cause__ from the caught DocumentLoadError to see python-pptx's actual complaint.","Re-save the deck from PowerPoint/Keynote as standard .pptx and retry.","Remove password protection before conversion.","Sniff the real format (filetype/python-magic) and route ODP/PDF/legacy inputs to their proper backends; for .ppt ensure soffice is on PATH."],"exampleFix":"# before\nresult = converter.convert('deck.pptx')  # actually ODP renamed\n\n# after\nimport filetype\nmime = filetype.guess('deck.pptx').mime\nassert mime in ('application/vnd.openxmlformats-officedocument.presentationml.presentation',)\nresult = converter.convert('deck.pptx')","handlingStrategy":"try-catch","validationCode":"import filetype\n\ndef is_real_pptx(path: str) -> bool:\n    kind = filetype.guess(path)\n    return kind is not None and kind.mime == (\n        'application/vnd.openxmlformats-officedocument.presentationml.presentation'\n    )","typeGuard":null,"tryCatchPattern":"from docling.core.exceptions import DocumentLoadError\ntry:\n    result = converter.convert(pptx_path)\nexcept DocumentLoadError as e:\n    log.error('deck load failed (%s): %s', pptx_path, e.__cause__)\n    quarantine(pptx_path)","preventionTips":["Verify magic bytes at upload instead of trusting the .pptx extension.","Require senders to export unprotected .pptx (no passwords).","Keep LibreOffice available for legacy .ppt and ODP fallback conversion."],"tags":["powerpoint","document-load","python-pptx","corrupt-file"],"backgroundTag":null,"analyzedSha":"61d76f1ff3f8428065465889f7b4577da7df704c","analyzedAt":"2026-08-14T23:53:18.727Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}