microsoft/markitdown · error · ValueError
Not supported tag: {tag.name}
Error message
Not supported tag: {tag.name} What it means
During DOCX pre-processing, math tags are rewritten: oMathPara becomes a w:p paragraph of block equations and oMath becomes an inline equation. Any other tag name reaching this branch raises ValueError — it is an internal invariant check inside the OMML pre-processing pass, not a user-configurable error.
Source
Thrown at packages/markitdown/src/markitdown/converter_utils/docx/pre_process.py:96
Args:
tag (Tag): A BeautifulSoup Tag object representing the OMML element. Could be either "oMathPara" or "oMath".
Raises:
ValueError: If the tag is not supported.
"""
if tag.name == "oMathPara":
# Create a new paragraph tag
p_tag = Tag(name="w:p")
# Replace each 'oMath' child tag with its LaTeX equivalent as block equations
for child_tag in tag.find_all("oMath"):
p_tag.append(_get_omath_tag_replacement(child_tag, block=True))
# Replace the original 'oMathPara' tag with the new paragraph tag
tag.replace_with(p_tag)
elif tag.name == "oMath":
# Replace the 'oMath' tag with its LaTeX equivalent as inline equation
tag.replace_with(_get_omath_tag_replacement(tag, block=False))
else:
raise ValueError(f"Not supported tag: {tag.name}")
def _pre_process_math(content: bytes) -> bytes:
"""
Pre-processes the math content in a DOCX -> XML file by converting OMML (Office Math Markup Language) elements to LaTeX.
This preprocessed content can be directly replaced in the DOCX file -> XMLs.
Args:
content (bytes): The XML content of the DOCX file as bytes.
Returns:
bytes: The processed content with OMML elements replaced by their LaTeX equivalents, encoded as bytes.
"""
soup = BeautifulSoup(content.decode(), features="xml")
for tag in soup.find_all("oMathPara"):
_replace_equations(tag)
for tag in soup.find_all("oMath"):
_replace_equations(tag)View on GitHub (pinned to fd239d5d2b)
Solutions
- Re-save the document with Microsoft Word/LibreOffice (normalizes the XML) and retry
- Upgrade markitdown — pre-processing coverage for additional tags may have been added
- Strip the math elements or export the document without equations as a workaround
- File an upstream issue attaching the offending document.xml snippet
Defensive patterns
Strategy: try-catch
Try / catch
try:
result = md.convert(docx_path)
except ValueError as e:
if "Not supported tag" in str(e):
log.warning("nonstandard math XML; re-save document via Word/LibreOffice and retry")
raise Prevention
- Normalize third-party-generated DOCX files by re-saving them in Word or LibreOffice before conversion
- Quarantine + alert on documents that fail preprocessing so authors can fix the source
When it happens
Trigger: A DOCX whose document.xml contains a math-related tag other than oMath/oMathPara reaching the replacement walker — typically from a corrupted file or a document produced by a non-standard generator with extra elements inside the math namespace.
Common situations: Third-party DOCX writers (reporting tools, converters) emitting unexpected tags in the m: namespace, or manually edited XML inside the zip.
Related errors
- Not support func %s
- Not support lim %s
- {converter} recognized the input as a potential {extension}
- File conversion failed after {len(attempts)} attempts:
- {converter} recognized the input as a potential {extension}
AI-assisted analysis of microsoft/markitdown@fd239d5d2b (2026-08-14).
Data as JSON: /api/errors/aefaf7653437dc99.
Report an issue: GitHub.