opendatalab/MinerU · error · ValueError

Unsupported office suffix: {file_suffix}

Error message

Unsupported office suffix: {file_suffix}

What it means

Raised in mineru/cli/common.py when a file was already classified as an office document (its suffix is in office_suffixes) but the suffix is not one of the three concrete analyzer families: docx_suffixes=['docx'], pptx_suffixes=['pptx'], xlsx_suffixes=['xlsx']. In practice this is unreachable with the shipped lists (office_suffixes is exactly the union of the three), so seeing it means the suffix lists were customized or the code was modified. Legacy binary formats .doc/.ppt/.xls are NOT supported anywhere in this code path.

Source

Thrown at mineru/cli/common.py:647

    need_remove_index = []
    for i, file_bytes in enumerate(pdf_bytes_list):
        pdf_file_name = pdf_file_names[i]
        file_suffix = guess_suffix_by_bytes(file_bytes)
        if file_suffix in office_suffixes:

            need_remove_index.append(i)

            local_image_dir, local_md_dir = prepare_env(output_dir, pdf_file_name, f"office")
            image_writer, md_writer = FileBasedDataWriter(local_image_dir), FileBasedDataWriter(local_md_dir)

            if file_suffix in docx_suffixes:
                office_analyze = office_docx_analyze
            elif file_suffix in pptx_suffixes:
                office_analyze = office_pptx_analyze
            elif file_suffix in xlsx_suffixes:
                office_analyze = office_xlsx_analyze
            else:
                raise ValueError(f"Unsupported office suffix: {file_suffix}")

            middle_json, infer_result = office_analyze(
                file_bytes,
                image_writer=image_writer,
            )

            f_draw_layout_bbox = False
            f_draw_span_bbox = False
            pdf_info = middle_json["pdf_info"]

            _process_output(
                pdf_info, file_bytes, pdf_file_name, local_md_dir, local_image_dir,
                md_writer, f_draw_layout_bbox, f_draw_span_bbox, f_dump_orig_file,
                f_dump_md, f_dump_content_list, f_dump_middle_json, f_dump_model_output,
                f_make_md_mode, middle_json, infer_result, process_mode=file_suffix
            )

    return need_remove_index

View on GitHub (pinned to 4fe4bde114)

Solutions

  1. Convert legacy files to the modern format first (.doc->.docx, .ppt->.pptx, .xls->.xlsx), e.g. with LibreOffice: soffice --headless --convert-to docx file.doc.
  2. If you edited office_suffixes, revert or also add an analyzer branch for the new suffix at common.py:640-645.
  3. Pre-filter inputs so only .docx/.pptx/.xlsx reach the office path and others fail early with a clear message.

Example fix

# before
# user uploads report.doc -> office_suffixes extended with 'doc' -> ValueError here

# after (convert before parsing)
# soffice --headless --convert-to docx report.doc
files = glob('*.docx') + glob('*.pptx') + glob('*.xlsx')
Defensive patterns

Strategy: validation

Validate before calling

SUPPORTED_OFFICE = {'.docx', '.pptx', '.xlsx'}

def check_office(path: str) -> None:
    if not any(path.lower().endswith(s) for s in SUPPORTED_OFFICE):
        raise ValueError(f'{path}: convert legacy Office files to docx/pptx/xlsx before parsing')

Type guard

from pathlib import Path

def is_supported_office(path: Path) -> bool:
    return path.suffix.lower() in {'.docx', '.pptx', '.xlsx'}

Prevention

When it happens

Trigger: Extending office_suffixes (e.g. adding 'doc' or 'odt') at mineru/cli/common.py:44-47 without adding a matching analyzer branch; passing a .doc/.ppt/.xls file and expecting office parsing; any direct call into the office-processing loop with a suffix outside docx/pptx/xlsx.

Common situations: Users with legacy Office files (.doc, .ppt, .xls) assuming all Office types work; forks that add new office extensions to the lists but forget the dispatch; version drift where lists and dispatch get out of sync.

Related errors


AI-assisted analysis of opendatalab/MinerU@4fe4bde114 (2026-08-14). Data as JSON: /api/errors/47a44cfa31673fc5. Report an issue: GitHub.