microsoft/markitdown · error · ValueError

Unknown feed type

Error message

Unknown feed type

What it means

RssConverter.convert() re-parses the XML and asks _feed_type() whether the document has an <rss> root element or a <feed> root with at least one <entry>. If neither matches, it raises ValueError('Unknown feed type'). Notably, accepts() uses the same _feed_type check for .xml/candidate mimetypes, so in the normal MarkItDown pipeline this is near-unreachable — it chiefly occurs when calling the converter's convert() directly, or when the stream content differs between the accepts() sniff and the convert() parse (non-deterministic stream, concurrent read, seek position bugs).

Source

Thrown at packages/markitdown/src/markitdown/converters/_rss_converter.py:99

                return "atom"
        return None

    def convert(
        self,
        file_stream: BinaryIO,
        stream_info: StreamInfo,
        **kwargs: Any,  # Options to pass to the converter
    ) -> DocumentConverterResult:
        self._kwargs = kwargs
        doc = minidom.parse(file_stream)
        feed_type = self._feed_type(doc)

        if feed_type == "rss":
            return self._parse_rss_type(doc)
        elif feed_type == "atom":
            return self._parse_atom_type(doc)
        else:
            raise ValueError("Unknown feed type")

    def _parse_atom_type(self, doc: Document) -> DocumentConverterResult:
        """Parse the type of an Atom feed.

        Returns None if the feed type is not recognized or something goes wrong.
        """
        root = doc.getElementsByTagName("feed")[0]
        title = self._get_data_by_tag_name(root, "title")
        subtitle = self._get_data_by_tag_name(root, "subtitle")
        entries = root.getElementsByTagName("entry")
        md_text = f"# {title}\n"
        if subtitle:
            md_text += f"{subtitle}\n"
        for entry in entries:
            entry_title = self._get_data_by_tag_name(entry, "title")
            entry_summary = self._get_data_by_tag_name(entry, "summary")
            entry_updated = self._get_data_by_tag_name(entry, "updated")
            entry_content = self._get_data_by_tag_name(entry, "content")

View on GitHub (pinned to fd239d5d2b)

Solutions

  1. Inspect the XML root element: valid RSS has <rss>, Atom has <feed> with <entry> children; anything else (including RSS 1.0/RDF) is not supported by this converter
  2. Rename the file / fix the mimetype so generic XML converters handle it instead of RssConverter
  3. For RSS 1.0 (RDF) feeds, convert them upstream to RSS 2.0 or Atom before passing to markitdown
  4. If calling convert() directly, first call accepts() on the same stream (reset with seek(0)) and skip when it returns False

Example fix

# before
converter = RssConverter()
result = converter.convert(stream, StreamInfo(extension='.rss', mimetype='application/rss+xml'))  # ValueError on sitemap.xml

# after
stream.seek(0)
if converter.accepts(stream, stream_info):
    stream.seek(0)
    result = converter.convert(stream, stream_info)
else:
    result = None  # not an RSS/Atom feed; handle elsewhere
Defensive patterns

Strategy: type-guard

Validate before calling

from defusedxml import minidom

def is_supported_feed(raw: bytes) -> bool:
    try:
        doc = minidom.parseString(raw)
    except Exception:
        return False
    if doc.getElementsByTagName("rss"):
        return True
    feeds = doc.getElementsByTagName("feed")
    return bool(feeds) and bool(feeds[0].getElementsByTagName("entry"))

Type guard

def is_supported_feed_stream(stream) -> bool:
    """Narrow: True only for RSS (<rss>) or Atom (<feed> with <entry>) docs."""
    pos = stream.tell()
    try:
        doc = minidom.parse(stream)
        if doc.getElementsByTagName("rss"):
            return True
        f = doc.getElementsByTagName("feed")
        return bool(f) and bool(f[0].getElementsByTagName("entry"))
    except Exception:
        return False
    finally:
        stream.seek(pos)

Try / catch

try:
    result = MarkItDown().convert("feed.rss")
except ValueError as e:
    if "Unknown feed type" in str(e):
        logger.warning("document is RSS 1.0/RDF or generic XML; not supported")

Prevention

When it happens

Trigger: Directly invoking RssConverter().convert() on XML that is neither RSS nor Atom (e.g. a sitemap.xml, SOAP envelope, or generic XML with extension .rss forced via StreamInfo); passing a stream whose position/content changed between accepts() and convert(); an Atom-like document whose <feed> element exists but contains no <entry> children (the code requires at least one entry for 'atom').

Common situations: A file named feed.rss that is actually a sitemap or RDF feed (RSS 1.0 uses RDF, not <rss>); Atom feeds with zero entries; code that constructs StreamInfo manually (extension='.rss') for arbitrary XML to force the converter.

Related errors


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