zylon-ai/private-gpt · error · ValueError
No valid document content found after conversion
Error message
No valid document content found after conversion
What it means
Raised by DoclingApiReader.lazy_load_data after a successful conversion when every page-content string produced by _get_content is empty (valid_contents filters out falsy entries and the list ends up empty). The server returned content-bearing fields, but after page splitting on the PAGE_PLACEHOLDER marker each fragment is blank/whitespace — so there is genuinely nothing to embed.
Source
Thrown at private_gpt/components/readers/docling/docling_api_reader.py:181
pages = file_info.config.get("pages", None)
try:
conversion_result = await self.client.convert_from_bytes(
file_name, file_bytes, to_formats=["md"], pages=pages, **load_kwargs
)
except Exception as e:
raise ValueError(f"Document conversion failed: {e}") from e
if conversion_result.status not in ["success", "partial_success"]:
raise ValueError(
f"Document conversion failed with status: {conversion_result.status}. "
f"Errors: {conversion_result.errors}"
)
contents = self._get_content(conversion_result)
valid_contents = [content for content in contents if content]
if not valid_contents:
raise ValueError("No valid document content found after conversion")
if self._is_extraction_unsuccessful(valid_contents):
raise ExtractionUnsuccessfulError(
f"Document extraction unsuccessful for '{file_name}': unmapped-glyph "
f"ratio exceeded threshold ({self.config.failure_threshold})."
)
docs = [
self._page_to_doc(
content=content,
index=idx,
include_page_metadata=len(valid_contents) > 1,
extra_info=extra_info,
)
for idx, content in enumerate(valid_contents)
]
if debug_mode:
logger.info(f"Loaded document from {file_name}")View on GitHub (pinned to 4a030776a3)
Solutions
- Remove or widen the pages filter in the file config so real content pages are included.
- Verify with an external tool (pdftotext) that the selected pages actually contain text; if not, enable OCR (docling.use_ocr + langs).
- Skip files that legitimately have no text at the pipeline level (a separate emptiness check) instead of sending them to Docling.
Defensive patterns
Strategy: validation
Validate before calling
# validate a requested page range actually has text before ingesting
import pypdf
def page_range_has_text(path: str, pages) -> bool:
reader = pypdf.PdfReader(path)
idx = pages if pages else range(len(reader.pages))
return any(reader.pages[i].extract_text().strip() for i in idx) Try / catch
try:
nodes = [n async for n in reader.lazy_load_data(file_info)]
except ValueError as e:
if "No valid document content" in str(e):
logger.warning("skipping empty document %s", file_info.file_name)
return []
raise Prevention
- Double-check the pages config points at content-bearing pages.
- Treat empty-output files as skip candidates, not crashes: catch and continue the batch.
When it happens
Trigger: Conversion returns a single empty page or all pages split to empty strings: page-range selections pointing at blank pages (pages config), documents whose text is entirely images with OCR off, placeholder-only content that the post-processing strips.
Common situations: Ingesting with a 'pages' filter that selects trailing blank pages; scanned documents with OCR disabled; test/placeholder PDFs generated with no text; trimmed exports where text lives in annotations not body content.
Related errors
- No valid content found in the conversion result
- Document conversion failed: {e}
- Document conversion failed with status: {conversion_result.s
- Document extraction unsuccessful for '{file_name}': unmapped
- Invalid system item in list (dict): {item}
AI-assisted analysis of zylon-ai/private-gpt@4a030776a3 (2026-08-15).
Data as JSON: /api/errors/b0786241a08fe4a7.
Report an issue: GitHub.