{"record":{"id":"d1379b426bb45402","repo":"docling-project/docling","slug":"conversion-failed-for-conv-res-input-file-with","errorCode":null,"errorMessage":"Conversion failed for: {conv_res.input.file} with status: {conv_res.status.value}.{error_details}","messagePattern":"Conversion failed for: (.+?) with status: (.+?)\\.(.+?)","errorType":"exception","errorClass":"ConversionError","httpStatus":null,"severity":"error","filePath":"docling/document_converter.py","lineNumber":581,"sourceCode":"        )\n        conv_res_iter = self._convert(conv_input, raises_on_error=raises_on_error)\n\n        had_result = False\n        for conv_res in conv_res_iter:\n            had_result = True\n            if raises_on_error and conv_res.status not in {\n                ConversionStatus.SUCCESS,\n                ConversionStatus.PARTIAL_SUCCESS,\n            }:\n                error_details = \"\"\n                if conv_res.errors:\n                    error_messages = [err.error_message for err in conv_res.errors]\n                    error_details = f\" Errors: {'; '.join(error_messages)}\"\n                # Chain the underlying exception (when one was captured during\n                # input construction) so callers can classify failures via\n                # ``__cause__`` — e.g. an encrypted PDF surfaces the original\n                # ``PdfiumError``. See issue #1920.\n                raise ConversionError(\n                    f\"Conversion failed for: {conv_res.input.file} with status: \"\n                    f\"{conv_res.status.value}.{error_details}\"\n                ) from get_input_rejection_cause(conv_res.input)\n            else:\n                yield conv_res\n\n        if not had_result and raises_on_error:\n            raise ConversionError(\n                \"Conversion failed because the provided file has no recognizable \"\n                \"format or it wasn't in the list of allowed formats.\"\n            )\n\n    @validate_call(config=ConfigDict(strict=True))\n    def convert_string(\n        self,\n        content: str,\n        format: InputFormat,\n        name: Optional[str] = None,","sourceCodeStart":563,"sourceCodeEnd":599,"githubUrl":"https://github.com/docling-project/docling/blob/61d76f1ff3f8428065465889f7b4577da7df704c/docling/document_converter.py#L563-L599","documentation":"After a conversion run, if raises_on_error is true and the result status is neither SUCCESS nor PARTIAL_SUCCESS, DocumentConverter raises ConversionError embedding the input file, the status value, and the joined per-error messages. The original exception from input construction is chained via `from get_input_rejection_cause(conv_res.input)` (issue #1920), so e.g. an encrypted PDF surfaces the underlying PdfiumError through __cause__.","triggerScenarios":"converter.convert(path) / convert_all(...) with raises_on_error=True (the default) on a document that fails: corrupt/unsupported file, encrypted PDF, backend exceptions, or rejected input. Any status like FAILURE triggers the raise with the collected error_message list.","commonSituations":"Batch jobs that die on the first bad file instead of continuing; encrypted PDFs; partially downloaded or zero-byte files; format backends missing optional dependencies.","solutions":["Read conv_res-equivalent details from the message and inspect the chained __cause__ to classify the real failure (e.g. PdfiumError for encrypted PDFs).","For batches, run convert_all(..., raises_on_error=False) and filter results by status, logging conv_res.errors for failures.","Fix the underlying document issue (decrypt the PDF, repair/redownload the file, install missing backend deps)."],"exampleFix":"# before\nresults = converter.convert_all(paths)  # dies on first bad file\n\n# after\nresults = converter.convert_all(paths, raises_on_error=False)\nfor res in results:\n    if res.status not in {ConversionStatus.SUCCESS, ConversionStatus.PARTIAL_SUCCESS}:\n        log.warning(\"skipped %s: %s\", res.input.file, [e.error_message for e in res.errors])","handlingStrategy":"try-catch","validationCode":null,"typeGuard":null,"tryCatchPattern":"try:\n    result = converter.convert(path)\nexcept ConversionError as e:\n    cause = e.__cause__  # e.g. PdfiumError for encrypted PDFs (issue #1920)\n    if isinstance(cause, PdfiumError):\n        mark_encrypted(path)\n    else:\n        log.error(\"conversion failed: %s\", e)\n    raise","preventionTips":["Use raises_on_error=False for batch jobs and inspect per-result status/errors.","Inspect the chained __cause__ to classify failures instead of string-matching messages.","Pre-screen for encrypted/corrupt PDFs before conversion."],"tags":["conversion","document-converter","error-handling","batch","pdf"],"backgroundTag":null,"analyzedSha":"61d76f1ff3f8428065465889f7b4577da7df704c","analyzedAt":"2026-08-14T23:53:18.727Z","schemaVersion":2},"datasetVersion":"2026-08-15T17:31:12.345Z"}