{"record":{"id":"70b28324af7a3868","repo":"xtekky/gpt4free","slug":"could-not-convert-stream-to-markdown-no-converter","errorCode":null,"errorMessage":"Could not convert stream to Markdown. No converter attempted a conversion, suggesting that the filetype is simply not supported.","messagePattern":"Could not convert stream to Markdown\\. No converter attempted a conversion, suggesting that the filetype is simply not supported\\.","errorType":"exception","errorClass":"UnsupportedFormatException","httpStatus":null,"severity":"error","filePath":"g4f/integration/markitdown/__init__.py","lineNumber":125,"sourceCode":"\n                if res is not None:\n                    if isinstance(res.text_content, str):\n                        # Normalize the content\n                        res.text_content = \"\\n\".join(\n                            [\n                                line.rstrip()\n                                for line in re.split(r\"\\r?\\n\", res.text_content)\n                            ]\n                        )\n                        res.text_content = re.sub(r\"\\n{3,}\", \"\\n\\n\", res.text_content)\n                    return res\n\n        # If we got this far without success, report any exceptions\n        if len(failed_attempts) > 0:\n            raise FileConversionException(attempts=failed_attempts)\n\n        # Nothing can handle it!\n        raise UnsupportedFormatException(\n            f\"Could not convert stream to Markdown. No converter attempted a conversion, suggesting that the filetype is simply not supported.\"\n        )\n\n    def convert_stream(\n        self,\n        stream: BinaryIO,\n        *,\n        stream_info: Optional[StreamInfo] = None,\n        file_extension: Optional[str] = None,  # Deprecated -- use stream_info\n        url: Optional[str] = None,  # Deprecated -- use stream_info\n        **kwargs: Any,\n    ) -> DocumentConverterResult:\n        guesses: List[StreamInfo] = []\n\n        # Do we have anything on which to base a guess?\n        base_guess = None\n        if stream_info is not None or file_extension is not None or url is not None:\n            # Start with a non-Null base guess","sourceCodeStart":107,"sourceCodeEnd":143,"githubUrl":"https://github.com/xtekky/gpt4free/blob/973504e1770928ed5fb82f43da528f441ad9ddc3/g4f/integration/markitdown/__init__.py#L107-L143","documentation":"Thrown by MarkItDown's MarkItDown.convert() (vendored in g4f/integration/markitdown) as UnsupportedFormatException when it iterates every registered converter and none accepts the input stream — no converter even attempted conversion. It distinguishes this from FileConversionException (raised when converters tried and failed): here the file type is simply unrecognized.","triggerScenarios":"Calling convert()/convert_stream() on a file whose (extension, mimetype, content) signature matches no registered converter — e.g. a proprietary binary format, a file with a misleading or missing extension, or an empty/garbage file that defeats detection.","commonSituations":"Users uploading .bin/.dat/.exe or Office/legacy formats not enabled (converters for docx/pdf/xlsx are optional dependencies); a .pdf handled by a converter that failed to import, leaving no accepting converter; a truncated upload where the magic bytes are missing.","solutions":["Confirm the file type with `file yourinput` and that its extension matches the content.","Install the optional converters for the format (e.g. pip install 'markitdown[all]' or the specific extra like pdf/docx) so a converter exists to accept it.","If the format is genuinely unsupported, convert it externally first (libreoffice --headless --convert-to docx, pandoc, etc.) then re-run.","If you expect the type to be supported but still see this, check that failed imports of converters are not silently disabling them (inspect the markitdown converters list)."],"exampleFix":"// before\nresult = md.convert(\"report.dat\")  # no converter accepts .dat\n\n// after\n# convert to a supported container first, then:\nresult = md.convert(\"report.docx\")","handlingStrategy":"try-catch","validationCode":"SUPPORTED_HINTS = (\".pdf\", \".docx\", \".pptx\", \".xlsx\", \".csv\", \".html\", \".htm\", \".txt\", \".md\", \".xml\", \".zip\", \".mp3\", \".wav\")\n\ndef probably_convertible(path: str) -> bool:\n    return os.path.splitext(path)[1].lower() in SUPPORTED_HINTS","typeGuard":null,"tryCatchPattern":"from markitdown import _markitdown.UnsupportedFormatException\ntry:\n    result = md.convert(path)\nexcept Exception as e:\n    if type(e).__name__ == \"UnsupportedFormatException\":\n        logger.info(\"skipping unsupported file %s\", path)\n        return None\n    raise","preventionTips":["Install the optional extras for the formats you accept (markitdown[all]).","Gate uploads by extension/MIME allowlist before invoking convert().","Convert exotic formats to docx/pdf/txt upstream."],"tags":["markitdown","file-conversion","unsupported-format"],"backgroundTag":null,"analyzedSha":"973504e1770928ed5fb82f43da528f441ad9ddc3","analyzedAt":"2026-08-14T23:45:32.408Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}