{"record":{"id":"8e9abc4b3860416c","repo":"docling-project/docling","slug":"expected-one-table-for-merge-count-merges-got","errorCode":null,"errorMessage":"expected one table for {merge_count} merges, got {len(document.tables)}","messagePattern":"expected one table for (.+?) merges, got (.+?)","errorType":"exception","errorClass":"RuntimeError","httpStatus":null,"severity":"error","filePath":"perfs/xlsx_merged_cells.py","lineNumber":149,"sourceCode":"def _run_benchmark(\n    output_dir: Path,\n    *,\n    merge_count: int,\n    runtime_info: RuntimeInfo,\n) -> BenchmarkResult:\n    workbook_path = output_dir / f\"merged-ranges-{merge_count}.xlsx\"\n    generation_seconds = _create_workbook(workbook_path, merge_count=merge_count)\n\n    tracemalloc.start()\n    started = time.perf_counter()\n    converter = DocumentConverter(allowed_formats=[InputFormat.XLSX])\n    document = converter.convert(workbook_path).document\n    conversion_seconds = time.perf_counter() - started\n    _, peak_memory = tracemalloc.get_traced_memory()\n    tracemalloc.stop()\n\n    if len(document.tables) != 1:\n        raise RuntimeError(\n            f\"expected one table for {merge_count} merges, got {len(document.tables)}\"\n        )\n    table = document.tables[0]\n    if table.data.num_rows != merge_count or table.data.num_cols != 4:\n        raise RuntimeError(\n            f\"unexpected table dimensions: {table.data.num_rows}x{table.data.num_cols}\"\n        )\n\n    return BenchmarkResult(\n        python_version=runtime_info.python_version,\n        platform=runtime_info.platform,\n        docling_version=runtime_info.docling_version,\n        commit_sha=runtime_info.commit_sha,\n        merge_count=merge_count,\n        non_empty_cells=merge_count * 2,\n        rectangle_area=merge_count * 4,\n        generation_seconds=round(generation_seconds, 6),\n        conversion_seconds=round(conversion_seconds, 6),","sourceCodeStart":131,"sourceCodeEnd":167,"githubUrl":"https://github.com/docling-project/docling/blob/61d76f1ff3f8428065465889f7b4577da7df704c/perfs/xlsx_merged_cells.py#L131-L167","documentation":"Error \"expected one table for {merge_count} merges, got {len(document.tables)}\" thrown in docling-project/docling.","triggerScenarios":"Raised by perfs/xlsx_merged_cells.py when converting the generated merged-cells XLSX yields a document whose table count is not exactly one.","commonSituations":"Regression in MsExcelDocumentBackend merged-cell handling, or a workbook layout that openpyxl reports in a way that splits or drops the expected single table.","solutions":["Verify the generated workbook: with N merges the script creates one sheet with N rows of merged ranges; conversion is expected to yield exactly one table.","Check the Docling version being benchmarked — a regression in the XLSX backend can split or drop tables; pin or bisect docling versions.","Inspect the merged-ranges-N.xlsx file in the output directory with openpyxl to confirm merges were written correctly before conversion."],"exampleFix":null,"handlingStrategy":null,"validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"61d76f1ff3f8428065465889f7b4577da7df704c","analyzedAt":"2026-08-14T23:53:18.727Z","schemaVersion":2},"datasetVersion":"2026-08-15T17:31:12.345Z"}