{"record":{"id":"6322d8306250e257","repo":"docling-project/docling","slug":"docling-parse-could-not-load-document-self-docume-6322d8","errorCode":null,"errorMessage":"docling-parse could not load document {self.document_hash}.","messagePattern":"docling-parse could not load document (.+?)\\.","errorType":"exception","errorClass":"DocumentLoadError","httpStatus":null,"severity":"error","filePath":"docling/backend/docling_parse_backend.py","lineNumber":303,"sourceCode":"                self._pdoc = pdfium.PdfDocument(self.path_or_stream, password=password)\n            self.parser = DoclingPdfParser(loglevel=\"fatal\")\n            decode_config = _make_docling_parse_decode_config(\n                enforce_same_font=self.options.enforce_same_font,\n            )\n            self.dp_doc = self.parser.load(\n                path_or_stream=self.path_or_stream,\n                password=password,\n                decode_config=decode_config,\n            )\n        except RuntimeError as e:\n            # pypdfium2 (PdfiumError) and docling-parse both signal unreadable\n            # bytes by raising RuntimeError; tag it as a load failure.\n            detail = str(e).strip()\n            if detail:\n                raise DocumentLoadError(\n                    f\"docling-parse could not load document {self.document_hash}: {detail}\"\n                ) from e\n            raise DocumentLoadError(\n                f\"docling-parse could not load document {self.document_hash}.\"\n            ) from e\n\n        if self.dp_doc is None:\n            raise DocumentLoadError(\n                f\"docling-parse could not load document {self.document_hash}.\"\n            )\n\n    def page_count(self) -> int:\n        # return len(self._pdoc)  # To be replaced with docling-parse API\n\n        len_1 = len(self._pdoc)\n        assert self.dp_doc is not None\n        len_2 = self.dp_doc.number_of_pages()\n\n        if len_1 != len_2:\n            _log.error(f\"Inconsistent number of pages: {len_1}!={len_2}\")\n","sourceCodeStart":285,"sourceCodeEnd":321,"githubUrl":"https://github.com/docling-project/docling/blob/61d76f1ff3f8428065465889f7b4577da7df704c/docling/backend/docling_parse_backend.py#L285-L321","documentation":"This is the minimal variant of the docling-parse load failure: DoclingParseDocumentBackend caught a RuntimeError while calling parser.load(), but the exception's message was empty after stripping, so no detail can be appended. It signals the same class of problem as the detailed variant (unreadable/corrupt PDF, failed password) — only the diagnostics are missing.","triggerScenarios":"parser.load() raises a bare RuntimeError('') or RuntimeError with whitespace-only text — typically from native docling-parse code paths that raise without a message on low-level parse failures.","commonSituations":"Same as the detailed load error: corrupt PDFs, encrypted PDFs without a password, non-PDF bytes routed to the PDF backend. The empty message just makes triage harder because there is no parser hint.","solutions":["Treat it exactly like the detailed load error: check the file opens with pypdfium2 and validate whether it is encrypted (pypdfium2.PdfDocument(...).is_encrypted, needs a password).","Supply PdfPipelineOptions.pdf_password if the file is encrypted.","Inspect the chained exception (e.__cause__) and its type for more context than the empty message.","Repair or re-acquire the file (qpdf --check / re-download) if it is corrupt."],"exampleFix":"# before\nresult = conv.convert(Path('weird.pdf'))  # RuntimeError with empty message\n\n# after\nimport pypdfium2 as pdfium\ntry:\n    pdf = pdfium.PdfDocument('weird.pdf')\nexcept Exception as e:\n    raise RuntimeError(f'file unusable before docling: {e}') from e\nresult = conv.convert(Path('weird.pdf'))","handlingStrategy":"try-catch","validationCode":"import pypdfium2 as pdfium\n\ndef pdf_usable(path) -> bool:\n    try:\n        pdf = pdfium.PdfDocument(str(path))\n        return not pdf.is_encrypted or bool(pdf.authenticate(\"\"))\n    except Exception:\n        return False","typeGuard":null,"tryCatchPattern":"from docling.exceptions import DocumentLoadError\ntry:\n    result = conv.convert(path)\nexcept DocumentLoadError as e:\n    if not str(e).rsplit(\":\", 1)[-1].strip():  # no detail appended\n        diagnose_with_pypdfium2_or_qpdf(path)  # e.__cause__ type is your only hint\n    raise","preventionTips":["Validate PDFs externally (pypdfium2 open, qpdf --check) when messages are empty.","Inspect e.__cause__ and its type for triage.","Pin docling and docling-parse to a tested version pair."],"tags":["pdf","docling-parse","document-load","diagnostics"],"backgroundTag":null,"analyzedSha":"61d76f1ff3f8428065465889f7b4577da7df704c","analyzedAt":"2026-08-14T23:53:18.727Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}