From 6c47a7d127a2ed222ff5412bf659ca08bad28321 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?In=C3=A1cio=20Nery?= Date: Thu, 27 Nov 2025 10:17:39 -0300 Subject: [PATCH] Fix ValueError when processing tables with empty cells --- pymupdf4llm/pymupdf4llm/helpers/pymupdf_rag.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/pymupdf4llm/pymupdf4llm/helpers/pymupdf_rag.py b/pymupdf4llm/pymupdf4llm/helpers/pymupdf_rag.py index 6b860800..c3d6f2bd 100644 --- a/pymupdf4llm/pymupdf4llm/helpers/pymupdf_rag.py +++ b/pymupdf4llm/pymupdf4llm/helpers/pymupdf_rag.py @@ -1052,6 +1052,10 @@ def get_page_output( else: tabs = page.find_tables(clip=parms.clip, strategy=table_strategy) for t in tabs.tables: + # Skip tables with no valid cells (would cause bbox calculation to fail) + if not any(c is not None for c in t.cells): + continue + # remove tables with too few rows or columns if t.row_count < 2 or t.col_count < 2: omitted_table_rects.append(pymupdf.Rect(t.bbox))