Skip to content

DOCX conversion fails with IndexError on unmatched field marks; fixed in mammoth 1.12.2, but MarkItDown pins mammoth~=1.11.0 #2646

Description

A Word document that has a complex-field separator or end mark without a matching start fails to convert:

FileConversionException: File conversion failed after 1 attempts:
 - DocxConverter threw IndexError with message: pop from empty list

Other users have hit this in real documents (mwilliamson/python-mammoth#168 and mwilliamson/python-mammoth#172). The attached document has one paragraph: "Reset value ", a field end mark, then "is 0x0.". Expected output: Reset value is 0x0.

markitdown-unmatched-field-end.docx

mammoth fixed this in 1.12.2 (mwilliamson/python-mammoth#168). That release also avoids excessive backtracking on unterminated strings in crafted documents. MarkItDown has pinned mammoth~=1.11.0 in the docx and all extras since #1452, so it can't pick up the fix. The latest MarkItDown, 0.1.8, still has that pin; the latest mammoth is 1.13.0.

Environment: markitdown 0.1.8 (main 4cc9fa1), mammoth 1.11.0, Python 3.14.8, Ubuntu 24.04.5 LTS.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions