{"record":{"id":"aa91eb4fea6b0870","repo":"run-llama/llama_index","slug":"object-obj-is-not-retrievable","errorCode":null,"errorMessage":"Object {obj} is not retrievable.","messagePattern":"Object (.+?) is not retrievable\\.","errorType":"exception","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"llama-index-core/llama_index/core/base/base_retriever.py","lineNumber":95,"sourceCode":"                f\"Retrieving from object {obj.__class__.__name__} with query {query_bundle.query_str}\\n\",\n                color=\"llama_pink\",\n            )\n        if isinstance(obj, NodeWithScore):\n            return [obj]\n        elif isinstance(obj, BaseNode):\n            return [NodeWithScore(node=obj, score=score)]\n        elif isinstance(obj, BaseQueryEngine):\n            response = obj.query(query_bundle)\n            return [\n                NodeWithScore(\n                    node=TextNode(text=str(response), metadata=response.metadata or {}),\n                    score=score,\n                )\n            ]\n        elif isinstance(obj, BaseRetriever):\n            return obj.retrieve(query_bundle)\n        else:\n            raise ValueError(f\"Object {obj} is not retrievable.\")\n\n    async def _aretrieve_from_object(\n        self,\n        obj: Any,\n        query_bundle: QueryBundle,\n        score: float,\n    ) -> List[NodeWithScore]:\n        \"\"\"Retrieve nodes from object.\"\"\"\n        if isinstance(obj, NodeWithScore):\n            return [obj]\n        elif isinstance(obj, BaseNode):\n            return [NodeWithScore(node=obj, score=score)]\n        elif isinstance(obj, BaseQueryEngine):\n            response = await obj.aquery(query_bundle)\n            return [\n                NodeWithScore(\n                    node=TextNode(text=str(response), metadata=response.metadata or {}),\n                    score=score,","sourceCodeStart":77,"sourceCodeEnd":113,"githubUrl":"https://github.com/run-llama/llama_index/blob/afd0fef371831f9bda13e5af7167cf4e981278ab/llama-index-core/llama_index/core/base/base_retriever.py#L77-L113","documentation":"During recursive retrieval, when an IndexNode references an object (node.obj or object_map[node.index_id]), BaseRetriever._retrieve_from_object handles NodeWithScore, BaseNode, BaseQueryEngine and BaseRetriever. Anything else — arbitrary Python objects, None-adjacent leftovers, plain strings — is not retrievable and raises ValueError.","triggerScenarios":"Building an IndexNode with obj= set to a type the dispatcher doesn't recognize (e.g. a query pipeline, a tool, a dict, a plain function) and then calling retriever.retrieve(); recursive retrieval over a tree/summary index whose object_map was populated with non-retriever objects.","commonSituations":"Using AutoMergingRetrieval or recursive document hierarchies with custom node objects; migrating old QueryPipeline-based recursion (BaseQueryEngine used to be handled, pipelines are not); storing raw metadata in obj by mistake.","solutions":["Make the IndexNode target a supported type: BaseRetriever, BaseQueryEngine, BaseNode, or NodeWithScore.","Wrap unsupported logic in a custom retriever (subclass BaseRetriever and implement _retrieve) and put that on the IndexNode.","Print type(node.obj) for the failing node to identify what was actually stored."],"exampleFix":"# before\nindex_node = IndexNode(text=\"helper\", index_id=\"x\", obj=my_query_pipeline)\n\n# after\nclass PipelineRetriever(BaseRetriever):\n    def _retrieve(self, query_bundle):\n        result = my_query_pipeline.run(query=query_bundle.query_str)\n        return [NodeWithScore(node=TextNode(text=str(result)))]\n\nindex_node = IndexNode(text=\"helper\", index_id=\"x\", obj=PipelineRetriever())","handlingStrategy":"type-guard","validationCode":"from llama_index.core.schema import BaseNode, NodeWithScore, IndexNode\nfrom llama_index.core.base.query_engine import BaseQueryEngine\nfrom llama_index.core.base.retriever import BaseRetriever\n\ndef index_node_retrievable(node: IndexNode) -> bool:\n    obj = node.obj\n    return obj is None or isinstance(obj, (BaseNode, NodeWithScore, BaseQueryEngine, BaseRetriever))","typeGuard":"from llama_index.core.base.retriever import BaseRetriever\nfrom llama_index.core.base.query_engine import BaseQueryEngine\n\ndef is_retrievable(obj) -> bool:\n    return isinstance(obj, (BaseRetriever, BaseQueryEngine))","tryCatchPattern":null,"preventionTips":["Only attach retrievers/query engines/nodes as IndexNode.obj targets.","Wrap custom logic in a BaseRetriever subclass.","Validate the whole index's IndexNodes in a build-time check."],"tags":["retriever","recursive-retrieval","index-node","type-dispatch"],"backgroundTag":null,"analyzedSha":"afd0fef371831f9bda13e5af7167cf4e981278ab","analyzedAt":"2026-08-15T05:42:58.429Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}