zylon-ai/private-gpt · error · ValueError

No valid content found in the conversion result

Error message

No valid content found in the conversion result

What it means

Raised by DoclingApiReader._get_content when the conversion result's document payload has empty md_content, text_content, and html_content (all falsy after the `or` chain). The server reported a successful conversion, but none of the text representations contain anything, so there is nothing to split into pages or ingest. This is distinct from a transport failure — it is an 'empty output' data-quality failure.

Source

Thrown at private_gpt/components/readers/docling/docling_api_reader.py:144

        self,
        conversion_result: DoclingApiOutputModel,
    ) -> list[str]:
        def post_process_content(c: str) -> list[str]:
            result = c

            # Replace API image placeholder with a custom one
            result = result.replace(DEFAULT_IMAGE_PLACEHOLDER, IMAGE_PLACEHOLDER)

            # Split pages into contents
            return result.split(PAGE_PLACEHOLDER)

        content = (
            conversion_result.document.md_content
            or conversion_result.document.text_content
            or conversion_result.document.html_content
        )
        if not content:
            raise ValueError("No valid content found in the conversion result")

        return post_process_content(content)

    async def lazy_load_data(
        self,
        file_info: FileInfo,
        extra_info: dict[str, Any] | None = None,
        execute_transformations: bool = True,
        notification: NotifyProtocol | None = None,
        *args: Any,
        **load_kwargs: Any,
    ) -> AsyncIterator[BaseNode]:
        """Lazy load file data into LlamaIndex Documents."""
        logger.debug("Starting Docling API parsing of file: %s", file_info.file_name)

        file_name = file_info.file_name or file_info.file_data.name
        file_data = file_info.file_data
        file_bytes = await asyncio.to_thread(file_data.read_bytes)

View on GitHub (pinned to 4a030776a3)

Solutions

  1. Enable OCR for the document/server (docling.use_ocr: true plus valid docling.langs) so scanned pages produce text.
  2. Open the file locally and confirm it actually has extractable text (pdftotext file.pdf - ); if output is empty, the file is image-only.
  3. If the file legitimately has no text, skip it in your ingestion pipeline instead of ingesting it.
  4. Check the conversion_result.errors field path (status partial_success) — upstream code surfaces errors separately; enabling debug logging shows the raw result.
Defensive patterns

Strategy: validation

Validate before calling

async def has_extractable_text(path: str) -> bool:
    # cheap local pre-check before sending to Docling
    import pypdf
    try:
        reader = pypdf.PdfReader(path)
        return any(page.extract_text().strip() for page in reader.pages)
    except Exception:
        return False  # cannot verify locally; let Docling decide

if not await has_extractable_text(path) and not docling_cfg.use_ocr:
    logger.warning("%s looks image-only but OCR is off", path)

Type guard

def has_content(model) -> bool:
    doc = model.document
    return bool(doc.md_content or doc.text_content or doc.html_content)

Try / catch

try:
    contents = reader._get_content(conversion_result)
except ValueError as e:
    if "No valid content" in str(e):
        mark_for_ocr_or_skip(file_info)  # scanned doc or no-text doc
    else:
        raise

Prevention

When it happens

Trigger: A successful/partial_success conversion of an image-only or scanned PDF with OCR disabled or OCR failing silently; a document whose pages contain only pictures/charts; a corrupt document that parses to zero pages; do_ocr=false on a scanned file. Raised per-file during lazy_load_data.

Common situations: Ingesting scanned PDFs into a Docling server built without OCR models; image-heavy decks exported to PDF; PDFs with text encoded in fonts Docling cannot map; partial_success where the only failed page was the sole content page.

Related errors


AI-assisted analysis of zylon-ai/private-gpt@4a030776a3 (2026-08-15). Data as JSON: /api/errors/f4f664568eb98883. Report an issue: GitHub.