{"record":{"id":"47a44cfa31673fc5","repo":"opendatalab/MinerU","slug":"unsupported-office-suffix-file-suffix","errorCode":null,"errorMessage":"Unsupported office suffix: {file_suffix}","messagePattern":"Unsupported office suffix: (.+?)","errorType":"validation","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"mineru/cli/common.py","lineNumber":647,"sourceCode":"    need_remove_index = []\n    for i, file_bytes in enumerate(pdf_bytes_list):\n        pdf_file_name = pdf_file_names[i]\n        file_suffix = guess_suffix_by_bytes(file_bytes)\n        if file_suffix in office_suffixes:\n\n            need_remove_index.append(i)\n\n            local_image_dir, local_md_dir = prepare_env(output_dir, pdf_file_name, f\"office\")\n            image_writer, md_writer = FileBasedDataWriter(local_image_dir), FileBasedDataWriter(local_md_dir)\n\n            if file_suffix in docx_suffixes:\n                office_analyze = office_docx_analyze\n            elif file_suffix in pptx_suffixes:\n                office_analyze = office_pptx_analyze\n            elif file_suffix in xlsx_suffixes:\n                office_analyze = office_xlsx_analyze\n            else:\n                raise ValueError(f\"Unsupported office suffix: {file_suffix}\")\n\n            middle_json, infer_result = office_analyze(\n                file_bytes,\n                image_writer=image_writer,\n            )\n\n            f_draw_layout_bbox = False\n            f_draw_span_bbox = False\n            pdf_info = middle_json[\"pdf_info\"]\n\n            _process_output(\n                pdf_info, file_bytes, pdf_file_name, local_md_dir, local_image_dir,\n                md_writer, f_draw_layout_bbox, f_draw_span_bbox, f_dump_orig_file,\n                f_dump_md, f_dump_content_list, f_dump_middle_json, f_dump_model_output,\n                f_make_md_mode, middle_json, infer_result, process_mode=file_suffix\n            )\n\n    return need_remove_index","sourceCodeStart":629,"sourceCodeEnd":665,"githubUrl":"https://github.com/opendatalab/MinerU/blob/4fe4bde114a23ee5dd637eae99b767f4669bf58c/mineru/cli/common.py#L629-L665","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","solutions":["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.","If you edited office_suffixes, revert or also add an analyzer branch for the new suffix at common.py:640-645.","Pre-filter inputs so only .docx/.pptx/.xlsx reach the office path and others fail early with a clear message."],"exampleFix":"# before\n# user uploads report.doc -> office_suffixes extended with 'doc' -> ValueError here\n\n# after (convert before parsing)\n# soffice --headless --convert-to docx report.doc\nfiles = glob('*.docx') + glob('*.pptx') + glob('*.xlsx')","handlingStrategy":"validation","validationCode":"SUPPORTED_OFFICE = {'.docx', '.pptx', '.xlsx'}\n\ndef check_office(path: str) -> None:\n    if not any(path.lower().endswith(s) for s in SUPPORTED_OFFICE):\n        raise ValueError(f'{path}: convert legacy Office files to docx/pptx/xlsx before parsing')","typeGuard":"from pathlib import Path\n\ndef is_supported_office(path: Path) -> bool:\n    return path.suffix.lower() in {'.docx', '.pptx', '.xlsx'}","tryCatchPattern":null,"preventionTips":["Convert .doc/.ppt/.xls to x-formats at ingest time (LibreOffice headless works in batch).","If you customize office_suffixes, update the analyzer dispatch in the same commit and add a test covering each suffix."],"tags":["mineru","office-documents","file-format","validation"],"backgroundTag":null,"analyzedSha":"4fe4bde114a23ee5dd637eae99b767f4669bf58c","analyzedAt":"2026-08-14T21:29:18.456Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}