microsoft/markitdown · error · UnsupportedFormatException

Could not convert stream to Markdown. No converter attempted

Error message

Could not convert stream to Markdown. No converter attempted a conversion, suggesting that the filetype is simply not supported.

What it means

Raised at the end of _convert_stream when failed_attempts is empty — meaning not a single registered converter's accepts() returned True for the stream_info. The library distinguishes 'converters tried and failed' (FileConversionException) from 'nobody handles this type' (UnsupportedFormatException). Typically the extension or MIME type is missing/unknown, so dispatch never happens.

Source

Thrown at packages/markitdown/src/markitdown/_markitdown.py:652

                            )
                        )
                    finally:
                        file_stream.seek(cur_pos)

                if res is not None:
                    # Normalize the content
                    res.text_content = "\n".join(
                        [line.rstrip() for line in re.split(r"\r?\n", res.text_content)]
                    )
                    res.text_content = re.sub(r"\n{3,}", "\n\n", res.text_content)
                    return res

        # If we got this far without success, report any exceptions
        if len(failed_attempts) > 0:
            raise FileConversionException(attempts=failed_attempts)

        # Nothing can handle it!
        raise UnsupportedFormatException(
            "Could not convert stream to Markdown. No converter attempted a conversion, suggesting that the filetype is simply not supported."
        )

    def register_page_converter(self, converter: DocumentConverter) -> None:
        """DEPRECATED: Use register_converter instead."""
        warn(
            "register_page_converter is deprecated. Use register_converter instead.",
            DeprecationWarning,
        )
        self.register_converter(converter)

    def register_converter(
        self,
        converter: DocumentConverter,
        *,
        priority: float = PRIORITY_SPECIFIC_FILE_FORMAT,
    ) -> None:
        """

View on GitHub (pinned to fd239d5d2b)

Solutions

  1. Pass explicit StreamInfo: md.convert(stream, stream_info=StreamInfo(extension='.pdf', mimetype='application/pdf'))
  2. Register a custom DocumentConverter whose accepts() recognizes your format
  3. Pre-convert the file to a supported format (e.g. LibreOffice --convert-to docx) before markitdown
  4. Upgrade markitdown — new versions add supported formats

Example fix

# before
md.convert(io.BytesIO(data))  # UnsupportedFormatException

# after
from markitdown import StreamInfo
md.convert(io.BytesIO(data), stream_info=StreamInfo(extension=".pdf", mimetype="application/pdf"))
Defensive patterns

Strategy: validation

Validate before calling

SUPPORTED_EXTS = {".docx", ".pdf", ".pptx", ".xlsx", ".html", ".csv", ".json", ".xml", ".zip", ".epub", ".ipynb", ".txt", ".md"}

def extension_supported(path: str, stream_info=None) -> bool:
    ext = (stream_info.extension if stream_info else None) or os.path.splitext(path)[1].lower()
    return ext in SUPPORTED_EXTS

Try / catch

from markitdown import UnsupportedFormatException

try:
    result = md.convert(stream, stream_info=stream_info)
except UnsupportedFormatException:
    log.info("no converter claims this type; trying plain-text fallback")
    result = md.convert(stream, stream_info=StreamInfo(mimetype="text/plain"))

Prevention

When it happens

Trigger: Calling md.convert(stream) with a StreamInfo lacking extension/mimetype, an exotic extension no converter claims (.xyz), or content-type detection yielding nothing that maps to a registered converter.

Common situations: Converting in-memory bytes while forgetting stream_info (the library cannot sniff every format from content), disabled/default-limited converter registrations, or new file formats the installed version does not know.

Related errors


AI-assisted analysis of microsoft/markitdown@fd239d5d2b (2026-08-14). Data as JSON: /api/errors/da906d2ec4a6b98b. Report an issue: GitHub.