{{ message }}
fix: detect ainsert signature instead of silently swallowing TypeError#251
Open
peterCheng123321 wants to merge 1 commit intoHKUDS:mainfrom
Open
fix: detect ainsert signature instead of silently swallowing TypeError#251peterCheng123321 wants to merge 1 commit intoHKUDS:mainfrom
peterCheng123321 wants to merge 1 commit intoHKUDS:mainfrom
Conversation
insert_text_content_with_multimodal_content was catching all exceptions and logging a hint, so a TypeError from an incompatible LightRAG version (ainsert lacking multimodal_content) caused the entire insert to be silently dropped — no text indexed, no doc_status written, and adelete_by_doc_id returning 404. Use inspect.signature to check upfront whether ainsert accepts multimodal_content, and fall back to text-only insertion with a visible warning if it does not. Real errors now propagate instead of being swallowed. Fixes HKUDS#244 Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.

Summary
Fixes #244.
insert_text_content_with_multimodal_contentinutils.pywas wrapping the entirelightrag.ainsert()call in a bareexcept Exceptionthat logged a hint and returned silently. When LightRAG'sainsertdoes not accept amultimodal_contentkeyword argument (i.e. the standard PyPI release rather than the RAGAnything branch), theTypeErrorwas swallowed — meaning:kv_store_doc_statusentry was writtenadelete_by_doc_idreturned 404Fix: use
inspect.signatureto check upfront whetherainsertacceptsmultimodal_content. If it does, call with the full argument set. If not, emit a visiblelogger.warningand fall back to text-only insertion so the document is still indexed anddoc_statusis correctly written. Real errors (network failures, LLM errors, etc.) now propagate instead of being silently dropped.Test plan
process_document_complete()against the standard PyPI LightRAG release — confirmkv_store_doc_statusis created andadelete_by_doc_idsucceedsainserterrors (e.g. bad API key) now surface as exceptions