{"record":{"id":"238302fdf38fc839","repo":"docling-project/docling","slug":"extraction-failed-because-the-provided-file-has-no","errorCode":null,"errorMessage":"Extraction failed because the provided file has no recognizable format or it wasn't in the list of allowed formats.","messagePattern":"Extraction failed because the provided file has no recognizable format or it wasn't in the list of allowed formats\\.","errorType":"exception","errorClass":"ConversionError","httpStatus":null,"severity":"error","filePath":"docling/document_extractor.py","lineNumber":190,"sourceCode":"        had_result = False\n        for ext_res in ext_res_iter:\n            had_result = True\n            if raises_on_error and ext_res.status not in {\n                ConversionStatus.SUCCESS,\n                ConversionStatus.PARTIAL_SUCCESS,\n            }:\n                error_details = \"\"\n                if ext_res.errors:\n                    error_messages = [err.error_message for err in ext_res.errors]\n                    error_details = f\" Errors: {'; '.join(error_messages)}\"\n                raise ConversionError(\n                    f\"Extraction failed for: {ext_res.input.file} with status: {ext_res.status.value}.{error_details}\"\n                )\n            else:\n                yield ext_res\n\n        if not had_result and raises_on_error:\n            raise ConversionError(\n                \"Extraction failed because the provided file has no recognizable format or it wasn't in the list of allowed formats.\"\n            )\n\n    # --------------------------- Internal engine ------------------------------\n\n    def _extract(\n        self,\n        conv_input: _DocumentConversionInput,\n        raises_on_error: bool,\n        template: ExtractionTemplateType,\n    ) -> Iterator[ExtractionResult]:\n        start_time = time.monotonic()\n\n        for input_batch in chunkify(\n            conv_input.docs(self.extraction_format_to_options),\n            settings.perf.doc_batch_size,\n        ):\n            _log.info(\"Going to extract document batch...\")","sourceCodeStart":172,"sourceCodeEnd":208,"githubUrl":"https://github.com/docling-project/docling/blob/61d76f1ff3f8428065465889f7b4577da7df704c/docling/document_extractor.py#L172-L208","documentation":"ConversionError raised by DocumentExtractor.extract() when the whole conversion/extension yields zero ExtractionResults and raises_on_error=True. Zero results means the file's format could not be recognized from its name/content, or the format is not in allowed_formats, so no pipeline ever ran.","triggerScenarios":"extractor.extract('data.xyz') where '.xyz' maps to no InputFormat; or passing allowed_formats/formats that exclude the file's actual format; or a DocumentStream whose name lacks a recognizable extension.","commonSituations":"Feeding extension-less temp files or wrongly-named DocumentStreams (name='tmp' instead of 'tmp.pdf'); copying the allowed_formats pattern from DocumentConverter examples but omitting the format actually being sent.","solutions":["Give the file/DocumentStream a name with a recognized extension (e.g. '.pdf', '.png').","Pass allowed_formats covering the actual format, or a format_options entry that maps it to a pipeline.","If the format is genuinely unsupported, convert it to a supported format (PDF/image) before extraction."],"exampleFix":"# before\nstream = DocumentStream(name='download', stream=BytesIO(pdf_bytes))\nextractor.extract([stream])  # no recognizable format\n\n# after\nstream = DocumentStream(name='download.pdf', stream=BytesIO(pdf_bytes))\nextractor.extract([stream])","handlingStrategy":"validation","validationCode":"from pathlib import Path\nSUPPORTED_EXTS = {'.pdf', '.png', '.jpg', '.jpeg', '.tif', '.tiff', '.bmp'}\nname = stream.name if isinstance(stream, DocumentStream) else str(path)\nassert Path(name).suffix.lower() in SUPPORTED_EXTS, f'unrecognizable name: {name}'","typeGuard":"def has_recognized_extension(name: str, exts: set[str]) -> bool:\n    return Path(name).suffix.lower() in exts","tryCatchPattern":"from docling.datamodel.base_models import ConversionError\ntry:\n    list(extractor.extract(inputs))\nexcept ConversionError as e:\n    if 'no recognizable format' in str(e):\n        for i in inputs:  # fix names/extensions, then retry\n            ...","preventionTips":["Always name DocumentStreams with a real, correct extension.","Validate extensions against your allowed_formats before submitting a batch."],"tags":["extraction","input-format","file-naming"],"backgroundTag":null,"analyzedSha":"61d76f1ff3f8428065465889f7b4577da7df704c","analyzedAt":"2026-08-14T23:53:18.727Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}