Skip to content

Debug Bad Document Ingestion - #1737

Open
Pooria90 wants to merge 21 commits into
mainfrom
1654-debug-bad-document-ingestion
Open

Pooria90 wants to merge 21 commits into
mainfrom
1654-debug-bad-document-ingestion

Conversation

@Pooria90

@Pooria90 Pooria90 commented Oct 23, 2026 •

Copy link
Copy Markdown
Contributor

Summary

Closes #1654.

One bad document no longer stops an ingest run. An undecodable file, a corrupt PDF, a failed download, or an error from the chunker or store is reported as a DocumentFailed event, and the rest of the corpus is still ingested.

  • Loaders yield a LoadFailure (source, error) for a source they can't read, then continue with the next one. Every file-based and cloud loader isolates each source through a shared _isolate_source helper on BaseDocumentLoader.
  • RetrievalRuntime turns each LoadFailure and each failing document into a DocumentFailed with a new stage field ("load", "chunk", "embed" or "store"). The new on_error="skip" | "raise" option defaults to "skip"; "raise" keeps the old behaviour.
  • Always raised, in both modes: EmbeddingModelMismatchError, errors raised out of a loader's own stream (it can't resume), and exceptions from the on_ingest callback.

Type of change

  • Bug fix
  • Feature
  • Breaking change
  • Docs
  • Refactor / chore / build / tests

Checklist

  • Lint & format pass (ruff check . && ruff format .)
  • Tests added/updated and pass locally (pytest tests)
  • Docs updated if user-facing behavior changed
  • Breaking changes include migration notes

Notes

Migration

  • BaseDocumentLoader.astream() now yields Document | LoadFailure. Code that reads astream() directly should check for LoadFailure. load(), aload() and Chunker.astream_documents still raise the error.
  • DocumentFailed has a new required stage field, and document_id is None when stage == "load".

Left out

@Pooria90 Pooria90 linked an issue Oct 23, 2026 that may be closed by this pull request
2 tasks
@Pooria90
Pooria90 marked this pull request as ready for review October 30, 2026 19:17
@Pooria90
Pooria90 requested a review from Amir-R25 October 30, 2026 19:20

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[09] [Bug] [Retrieval] One bad document aborts the whole ingest run

1 participant