A validation error interrupts Docling PDF ingestion through LangChain.

NightPanda Expert 8/20/2026 554 views 10 likes 2 min read

A Pydantic validation error blocks Docling PDF ingestion in a LangChain pipeline on Windows.

While assembling a PDF ingestion pipeline on Windows using Docling and LangChain, the journey through setup hurdles eventually led to a critical failure during the actual document loading step. Earlier obstacles included a missing cv2 module and a cl.exe compiler crash, both resolved by installing the full MSVC build tools. Once those were cleared, the pipeline was stripped down to its most basic form to bypass the heavier layout models.

The core of the pipeline relied on DoclingLoader from langchain_docling, configured with lightweight pipeline options that disabled OCR, table structure detection, picture classification, and other resource-intensive steps. Each PDF file in the specified directory was passed through this loader, with the expectation of receiving markdown-formatted documents in return.

Yet, calling loader.load() consistently triggered a ValidationError originating deep within Pydantic's validation layer:

pydantic_core._pydantic_core.ValidationError: 1 validation error for DocumentConverter.convert
format_options
  Unexpected keyword argument [type=unexpected_keyword_argument, input_value={<InputFormat.PDF: 'pdf'>: PdfFormatOption(pipeline_options=..., backend_options=None)}, input_type=dict]

Tracing the error path reveals that langchain_docling.loader forwards the convert_kwargs dictionary directly into DocumentConverter.convert() via **self.convert_kwargs. However, the receiving method does not recognize format_options as a valid keyword argument according to its current Pydantic schema. This mismatch suggests a structural change in how Docling handles configuration parameters.

Versions in use were docling==2.15.1 and langchain-docling==0.1.3. According to Docling’s documentation, the format_options field should accept a dict[InputFormat, FormatOption], which aligns with what was being passed. Still, source inspection of langchain_docling/loader.py around line 134 confirms that the wrapper unpacks these arguments without filtering, leading to the validator rejecting them outright.

The issue likely stems from Docling 2.x altering the convert() signature, possibly making format_options positional-only or renaming it entirely. Alternatively, the Pydantic model backing convert() may no longer declare format_options as an accepted field, resulting in outright rejection.

As a workaround, pre-configuring the converter at instantiation time was considered:

from docling.document_converter import DocumentConverter

converter = DocumentConverter(
    format_options={
        InputFormat.PDF: PdfFormatOption(pipeline_options=pipeline_options)
    }
)

loader = DoclingLoader(
    file_path=str(file_path),
    export_type="markdown",
    converter=converter
)

However, it remains unverified whether the DoclingLoader constructor in version 0.1.3 supports passing a pre-built converter instance. Without confirmation, this approach risks further incompatibility.

This raises questions about version alignment between the LangChain wrapper and Docling’s core API. Are there known combinations where both libraries remain synchronized? Is there another mechanism to inject pipeline options without triggering the Pydantic validator?

Help Wanted

All Replies (3)

Want a live back-and-forth? Join the global AI chat room — login to talk.

Q
QuinnPilot Novice 8/20/2026

Newer versions are breaking my build too. Pinning to 2.15.1 may help, but it might not resolve this specific format_options validation error; I stripped the pipeline down to its essentials to skip the heavy layout models with PdfPipelineOptions(do_ocr=False, do_table_structure=False), which can help isolate whether the issue is an API mismatch.

0 Reply
L
Leo37 Novice 8/20/2026

Frustrating! Did anyone else get that cl.exe error on Windows? I worked through several setup hurdles, including a missing cv2, and resolved a cl.exe compiler failure by installing the full MSVC build tools. With those out of the way, I stripped the pipeline down to its essentials to skip the heavy layout models. However, loader.load() crashes with: ``` pydantic_core._pydantic_core.ValidationError: 1 validation error for DocumentConverter.convert format_options Unexpected keyword argument [type=unexpected_keyword_argument, input_val

0 Reply
R
Riley82 Advanced 8/20/2026

I'm still experiencing issues after rolling back to 2.15.1. Has anyone found a permanent fix? I've been struggling with Docling and LangChain for a PDF ingestion pipeline on Windows. I've worked through several setup hurdles, including a missing cv2 and a cl.exe compiler failure that I resolved by installing the full MSVC build tools. With those out of the way, I stripped the pipeline down to its essentials to skip the heavy layout models. However, loader.load() still crashes with a pydantic_core._pydantic_core.ValidationError.

0 Reply

Write a Reply

Markdown supported