docling-project/docling · error · DocumentLoadError
MsPowerpointDocumentBackend could not load document with has
Error message
MsPowerpointDocumentBackend could not load document with hash {self.document_hash} What it means
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.
Source
Thrown at docling/backend/mspowerpoint_backend.py:167
super().__init__(in_doc, path_or_stream, options)
self.path_or_stream: Union[BytesIO, Path] = path_or_stream
self.page_range = in_doc.limits.page_range
self.pptx_to_pdf_converter: Optional[Callable] = None
self.pptx_to_pdf_converter_init: bool = False
self._render_charts: bool = False
self.pptx_obj: Optional[presentation.Presentation] = None
self.valid: bool = False
try:
if isinstance(self.path_or_stream, BytesIO):
self.pptx_obj = Presentation(self.path_or_stream)
elif isinstance(self.path_or_stream, Path):
self.pptx_obj = Presentation(str(self.path_or_stream))
self.valid = True
except Exception as e:
raise DocumentLoadError(
f"MsPowerpointDocumentBackend could not load document with hash {self.document_hash}"
) from e
return
def page_count(self) -> int:
if self.is_valid():
assert self.pptx_obj is not None
return len(self.pptx_obj.slides)
else:
return 0
@override
def is_valid(self) -> bool:
return self.valid
@classmethod
@overrideView on GitHub (pinned to 61d76f1ff3)
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.
Example fix
# before
result = converter.convert('deck.pptx') # actually ODP renamed
# after
import filetype
mime = filetype.guess('deck.pptx').mime
assert mime in ('application/vnd.openxmlformats-officedocument.presentationml.presentation',)
result = converter.convert('deck.pptx') Defensive patterns
Strategy: try-catch
Validate before calling
import filetype
def is_real_pptx(path: str) -> bool:
kind = filetype.guess(path)
return kind is not None and kind.mime == (
'application/vnd.openxmlformats-officedocument.presentationml.presentation'
) Try / catch
from docling.core.exceptions import DocumentLoadError
try:
result = converter.convert(pptx_path)
except DocumentLoadError as e:
log.error('deck load failed (%s): %s', pptx_path, e.__cause__)
quarantine(pptx_path) Prevention
- 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.
When it happens
Trigger: 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.
Common situations: Upload pipelines receiving mislabeled or password-protected decks, Keynote/Google-Slides exports with quirks, corrupted email attachments, or missing/broken LibreOffice for legacy .ppt.
Related errors
- docling-parse could not load document {self.document_hash}:
- MsExcelDocumentBackend could not load document with hash {se
- CsvDocumentBackend could not load document with hash {self.d
- docling-parse could not load document {self.document_hash}.
- Could not initialize the EBCDIC backend for file with hash {
AI-assisted analysis of docling-project/docling@61d76f1ff3 (2026-08-14).
Data as JSON: /api/errors/3eea7e62675f0187.
Report an issue: GitHub.