docling-project/docling · error · RuntimeError

No pages to process.

Error message

No pages to process.

What it means

After iterating the pages of a conversion result, VlmPipeline collects one DoclingDocument per page (real or empty fallback documents for failed pages). If that list ends up empty, there were no pages to merge, and _add_page_metadata_and_concatenate raises 'No pages to process.' before calling DoclingDocument.concatenate. This means the input produced zero initialized pages, e.g. an empty or unreadable document.

Source

Thrown at docling/pipeline/vlm_pipeline.py:442

                        component_type=DoclingComponentType.PIPELINE,
                        module_name=self.__class__.__name__,
                        error_message=f"DoclangDeserializer failed: {exc}",
                        category=FailureCategory.BACKEND_FAILURE,
                        page_no=idx + 1,
                    )
                )
                conv_res.status = ConversionStatus.PARTIAL_SUCCESS
                # Create empty document for failed pages
                empty_doc = DoclingDocument(name=f"page_{idx}")
                empty_doc.add_page(
                    page_no=idx + 1,
                    size=Size(width=img.width, height=img.height),
                    image=ImageRef.from_pil(image=img, dpi=72),
                )
                page_docs.append(empty_doc)

        if not page_docs:
            raise RuntimeError("No pages to process.")

        if len(page_docs) == 1:
            return page_docs[0]

        return DoclingDocument.concatenate(docs=page_docs)

    def _turn_dt_into_doc(self, conv_res) -> DoclingDocument:
        doctags_list = []
        image_list = []
        for page in conv_res.pages:
            predicted_doctags = ""
            img = PILImage.new("RGB", (1, 1), "rgb(255,255,255)")
            if page.predictions.vlm_response:
                predicted_doctags = page.predictions.vlm_response.text
            if page.image:
                img = page.image
            image_list.append(img)
            doctags_list.append(predicted_doctags)

View on GitHub (pinned to 61d76f1ff3)

Solutions

  1. Open the input in a viewer or with pypdf to confirm it actually has pages and is not corrupt.
  2. Re-download or regenerate the source document if it is truncated.
  3. Skip such files early in batch processing by checking page count before conversion.
  4. If pages exist but all fail, inspect earlier log messages for the underlying per-page failure (OCR/model errors) and fix that.

Example fix

# before
result = converter.convert(Path('empty.pdf'))  # RuntimeError: No pages to process.

# after
from pypdf import PdfReader
if len(PdfReader('doc.pdf').pages) == 0:
    skip('doc.pdf')
else:
    result = converter.convert(Path('doc.pdf'))
Defensive patterns

Strategy: validation

Validate before calling

def has_pages(path) -> bool:
    from pypdf import PdfReader
    return len(PdfReader(path).pages) > 0

assert has_pages(p) before convert

Try / catch

try:
    result = converter.convert(path)
except RuntimeError as e:
    if 'No pages to process' in str(e):
        skip_or_quarantine(path)

Prevention

When it happens

Trigger: Converting a zero-page or corrupt PDF/image whose backend loaded no pages; every page failing before any page document (including fallback empty docs) is appended; a document stream with no page content fed to the VLM pipeline.

Common situations: Empty PDF (0 pages) generated by a failed print job; truncated downloads that parse to no pages; test fixtures with blank files; feeding a document whose pages all failed so early that no per-page document was created.

Related errors


AI-assisted analysis of docling-project/docling@61d76f1ff3 (2026-08-14). Data as JSON: /api/errors/a8379eb100abcdac. Report an issue: GitHub.