# ValueError: Cannot create Document from empty text. Node content is None or empty string.

- **ID:** `llm/llamaindex-empty-node-from-parser`
- **Domain:** llm
- **Category:** data_error
- **Verification:** ai_generated
- **Fix Rate:** 92%

## Root Cause

LlamaIndex document parser received a file or chunk with no extractable text, often from binary files (PDFs without OCR, images) or empty markdown sections.

## Version Compatibility

| Version | Status | Introduced | Deprecated |
|---------|--------|------------|------------|
| llama-index==0.10.43 | active | — | — |
| llama-index-core==0.10.43 | active | — | — |
| pypdf==4.2.0 | active | — | — |

## Workarounds

1. **Add a filter to skip files with no text before parsing: `if not file_content.strip(): continue` in the ingestion loop.** (90% success)
   ```
   Add a filter to skip files with no text before parsing: `if not file_content.strip(): continue` in the ingestion loop.
   ```
2. **Use a try-except block to catch the ValueError and log the file path for manual review: `try: doc = parser.parse(file); except ValueError as e: logger.warning(f'Skipping {file}: {e}')`** (95% success)
   ```
   Use a try-except block to catch the ValueError and log the file path for manual review: `try: doc = parser.parse(file); except ValueError as e: logger.warning(f'Skipping {file}: {e}')`
   ```
3. **For PDFs, enable OCR with `pypdf` or `pdfplumber` to extract text from scanned documents: `pip install pypdf[ocr]` and set `parser = SimpleDirectoryReader(required_exts=['.pdf'], file_extractor={'.pdf': PDFReader(ocr=True)})`** (85% success)
   ```
   For PDFs, enable OCR with `pypdf` or `pdfplumber` to extract text from scanned documents: `pip install pypdf[ocr]` and set `parser = SimpleDirectoryReader(required_exts=['.pdf'], file_extractor={'.pdf': PDFReader(ocr=True)})`
   ```

## Dead Ends

- **** — The pipeline may silently drop valid data if the error is not caught and logged; the empty node is still created but breaks downstream indexing. (70% fail)
- **** — Empty text is not a chunk size issue; the source file itself has no extractable content. (95% fail)
- **** — Conversion may still produce empty files for binary inputs; the root cause is lack of extractable text, not format. (80% fail)
