{"record":{"id":"73bc97d13865a88d","repo":"run-llama/llama_index","slug":"no-nodes-returned-by-vector-query","errorCode":null,"errorMessage":"No nodes returned by vector_query","messagePattern":"No nodes returned by vector_query","errorType":"exception","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"llama-index-core/llama_index/core/indices/property_graph/sub_retrievers/vector.py","lineNumber":142,"sourceCode":"            \"similarity_top_k\": self._similarity_top_k,\n            \"filters\": self._filters,\n        }\n        vsq_kwargs.update(self._retriever_kwargs)\n\n        return self._build_vector_store_query(**vsq_kwargs)\n\n    def retrieve_from_graph(\n        self, query_bundle: QueryBundle, limit: Optional[int] = None\n    ) -> List[NodeWithScore]:\n        vector_store_query = self._get_vector_store_query(query_bundle)\n\n        triplets = []\n        kg_ids = []\n        new_scores = []\n        if self._graph_store.supports_vector_queries:\n            result = self._graph_store.vector_query(vector_store_query)\n            if len(result) != 2:\n                raise ValueError(\"No nodes returned by vector_query\")\n            kg_nodes, scores = result\n\n            kg_ids = [node.id for node in kg_nodes]\n            triplets = self._graph_store.get_rel_map(\n                kg_nodes,\n                depth=self._path_depth,\n                limit=limit or self._limit,\n                ignore_rels=[KG_SOURCE_REL],\n            )\n\n        elif self._vector_store is not None:\n            query_result = self._vector_store.query(vector_store_query)\n            if query_result.nodes is not None and query_result.similarities is not None:\n                kg_ids = self._get_kg_ids(query_result.nodes)\n                scores = query_result.similarities\n                kg_nodes = self._graph_store.get(ids=kg_ids)\n                triplets = self._graph_store.get_rel_map(\n                    kg_nodes,","sourceCodeStart":124,"sourceCodeEnd":160,"githubUrl":"https://github.com/run-llama/llama_index/blob/afd0fef371831f9bda13e5af7167cf4e981278ab/llama-index-core/llama_index/core/indices/property_graph/sub_retrievers/vector.py#L124-L160","documentation":"VectorContextRetriever.retrieve_from_graph unpacks the result of graph_store.vector_query() as a 2-tuple (nodes, scores). If a custom graph store's vector_query returns something else (a list of results, a single flat list, a dict), len(result) != 2 and this error raises. Despite the message, it usually indicates a malformed return value, not an empty result.","triggerScenarios":"Implementing vector_query on a custom PropertyGraphStore and returning e.g. [NodeWithScore(...)] or a dict instead of (List[LabelledNode], List[float]]; also triggered by a store returning a 3-element tuple with extra metadata.","commonSituations":"Writing a custom property graph store for a database lacking an official integration; upgrading llama-index where the expected vector_query contract (tuple of nodes+scores) differs from an older/different shape your store implemented.","solutions":["Make your vector_query return exactly (nodes, scores) where nodes is List[LabelledNode] and scores is List[float], both of the same length","Subclass SimplePropertyGraphStore or copy an existing integration (e.g. Neo4j's) as the contract reference","If you do not want vector queries in the graph store, set supports_vector_queries = False and provide an external vector_store instead"],"exampleFix":"# before\nclass MyStore(SimplePropertyGraphStore):\n    def vector_query(self, query):\n        return [NodeWithScore(node=n, score=s) for n, s in zip(nodes, scores)]\n\n# after\nclass MyStore(SimplePropertyGraphStore):\n    def vector_query(self, query):\n        return nodes, scores  # exactly two sequences","handlingStrategy":"validation","validationCode":"result = graph_store.vector_query(vector_store_query)\nassert isinstance(result, tuple) and len(result) == 2, (\n    'vector_query must return (nodes, scores); add a conformance test for custom stores'\n)","typeGuard":"def is_valid_vector_result(result) -> bool:\n    return (\n        isinstance(result, (tuple, list)) and len(result) == 2\n        and isinstance(result[0], list)\n    )","tryCatchPattern":"try:\n    nodes = retriever.retrieve_from_graph(qb)\nexcept ValueError as e:\n    if 'vector_query' in str(e):\n        # bug in custom store: fix vector_query to return (nodes, scores)\n        raise","preventionTips":["Write a conformance test suite for custom PropertyGraphStores asserting the (nodes, scores) tuple shape","Copy the Neo4j store implementation as the reference contract"],"tags":["llama-index","property-graph","vector-store","custom-store","contract"],"backgroundTag":null,"analyzedSha":"afd0fef371831f9bda13e5af7167cf4e981278ab","analyzedAt":"2026-08-15T05:42:58.429Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}