llamaIndex - 💡(How to fix) Fix [Bug]: obj serialization mismatch [2 pull requests]

Official PRs (…)
ON THIS PAGE

Recommended Tools

×6

Utilities matched from this issue’s tags and category — try them while you read without losing context.

GitHub issue graph ai analysis

Paste a GitHub issue URL. We fetch that issue, discover linked issues from bodies/comments/timeline, collect linked pull requests, and produce a structured English report.

The report is written in English Markdown for sharing and archival.

Helpful · Quick feedback

Loading…

Error Message

It thus throws an exception and replaces the obj with the backup variant of a new TextNode with the serialized obj as text content.

Fix Action

Fixed

RAW_BUFFERClick to expand / collapse

Bug Description

In pr #18447, serialization using node.dict() was replaced with the newer node.model_dump(...) in multiple places, e.g. in node_to_metadata_dict(). The previous .dict() was subclassed for IndexNodes to wrap the contents of the obj field with an additional __type__ field (using doc_to_json()). model_dump() is not subclassed.

It does not seem like the deserialization was updated to reflect this. metadata_dict_to_node() calls BaseComponent.from_json(node_json), which calls IndexNode.from_dict(...), which calls json_to_doc(), which expectes the __type__ wrapper. It thus throws an exception and replaces the obj with the backup variant of a new TextNode with the serialized obj as text content.

Version

0.14.21

Steps to Reproduce

This occured for me when using a BM25 retriever, which serializes the nodes for its corpus. When inputting IndexNodes, the underlying TextNodes are not deserialized correctly on retrieval.

Vote matrix · Quick signals

Works
Did the solution work? Tap to confirm.
Easy Fix
Was it a quick fix?
Time Saver
Did it save you time?
Blocking
Was it severely blocking?
Common Issue
Are others likely hitting this too?
Flaky / Intermittent
Is it intermittent?
Verified / Reproducible
Can you reproduce it reliably?
Loading…

Still need to ship something?

×6

Another batch ranked right after the header list — different links, same matching logic.

Back to top recommendations

TRENDING

llamaIndex - 💡(How to fix) Fix [Bug]: obj serialization mismatch [2 pull requests]