{"record":{"id":"aefaf7653437dc99","repo":"microsoft/markitdown","slug":"not-supported-tag-tag-name","errorCode":null,"errorMessage":"Not supported tag: {tag.name}","messagePattern":"Not supported tag: (.+?)","errorType":"exception","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"packages/markitdown/src/markitdown/converter_utils/docx/pre_process.py","lineNumber":96,"sourceCode":"    Args:\n        tag (Tag): A BeautifulSoup Tag object representing the OMML element. Could be either \"oMathPara\" or \"oMath\".\n\n    Raises:\n        ValueError: If the tag is not supported.\n    \"\"\"\n    if tag.name == \"oMathPara\":\n        # Create a new paragraph tag\n        p_tag = Tag(name=\"w:p\")\n        # Replace each 'oMath' child tag with its LaTeX equivalent as block equations\n        for child_tag in tag.find_all(\"oMath\"):\n            p_tag.append(_get_omath_tag_replacement(child_tag, block=True))\n        # Replace the original 'oMathPara' tag with the new paragraph tag\n        tag.replace_with(p_tag)\n    elif tag.name == \"oMath\":\n        # Replace the 'oMath' tag with its LaTeX equivalent as inline equation\n        tag.replace_with(_get_omath_tag_replacement(tag, block=False))\n    else:\n        raise ValueError(f\"Not supported tag: {tag.name}\")\n\n\ndef _pre_process_math(content: bytes) -> bytes:\n    \"\"\"\n    Pre-processes the math content in a DOCX -> XML file by converting OMML (Office Math Markup Language) elements to LaTeX.\n    This preprocessed content can be directly replaced in the DOCX file -> XMLs.\n\n    Args:\n        content (bytes): The XML content of the DOCX file as bytes.\n\n    Returns:\n        bytes: The processed content with OMML elements replaced by their LaTeX equivalents, encoded as bytes.\n    \"\"\"\n    soup = BeautifulSoup(content.decode(), features=\"xml\")\n    for tag in soup.find_all(\"oMathPara\"):\n        _replace_equations(tag)\n    for tag in soup.find_all(\"oMath\"):\n        _replace_equations(tag)","sourceCodeStart":78,"sourceCodeEnd":114,"githubUrl":"https://github.com/microsoft/markitdown/blob/fd239d5d2be43d9b68329730206b9312c7d5a388/packages/markitdown/src/markitdown/converter_utils/docx/pre_process.py#L78-L114","documentation":"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.","triggerScenarios":"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.","commonSituations":"Third-party DOCX writers (reporting tools, converters) emitting unexpected tags in the m: namespace, or manually edited XML inside the zip.","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"],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":null,"typeGuard":null,"tryCatchPattern":"try:\n    result = md.convert(docx_path)\nexcept ValueError as e:\n    if \"Not supported tag\" in str(e):\n        log.warning(\"nonstandard math XML; re-save document via Word/LibreOffice and retry\")\n        raise","preventionTips":["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"],"tags":["omml","docx","preprocessing","corrupt-file"],"backgroundTag":null,"analyzedSha":"fd239d5d2be43d9b68329730206b9312c7d5a388","analyzedAt":"2026-08-14T15:47:51.745Z","schemaVersion":2},"datasetVersion":"2026-08-15T17:31:12.345Z"}