run-llama/llama_index · error · ValueError

No nodes returned by vector_query

Error message

No nodes returned by vector_query

What it means

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.

Source

Thrown at llama-index-core/llama_index/core/indices/property_graph/sub_retrievers/vector.py:142

            "similarity_top_k": self._similarity_top_k,
            "filters": self._filters,
        }
        vsq_kwargs.update(self._retriever_kwargs)

        return self._build_vector_store_query(**vsq_kwargs)

    def retrieve_from_graph(
        self, query_bundle: QueryBundle, limit: Optional[int] = None
    ) -> List[NodeWithScore]:
        vector_store_query = self._get_vector_store_query(query_bundle)

        triplets = []
        kg_ids = []
        new_scores = []
        if self._graph_store.supports_vector_queries:
            result = self._graph_store.vector_query(vector_store_query)
            if len(result) != 2:
                raise ValueError("No nodes returned by vector_query")
            kg_nodes, scores = result

            kg_ids = [node.id for node in kg_nodes]
            triplets = self._graph_store.get_rel_map(
                kg_nodes,
                depth=self._path_depth,
                limit=limit or self._limit,
                ignore_rels=[KG_SOURCE_REL],
            )

        elif self._vector_store is not None:
            query_result = self._vector_store.query(vector_store_query)
            if query_result.nodes is not None and query_result.similarities is not None:
                kg_ids = self._get_kg_ids(query_result.nodes)
                scores = query_result.similarities
                kg_nodes = self._graph_store.get(ids=kg_ids)
                triplets = self._graph_store.get_rel_map(
                    kg_nodes,

View on GitHub (pinned to afd0fef371)

Solutions

  1. Make your vector_query return exactly (nodes, scores) where nodes is List[LabelledNode] and scores is List[float], both of the same length
  2. Subclass SimplePropertyGraphStore or copy an existing integration (e.g. Neo4j's) as the contract reference
  3. If you do not want vector queries in the graph store, set supports_vector_queries = False and provide an external vector_store instead

Example fix

# before
class MyStore(SimplePropertyGraphStore):
    def vector_query(self, query):
        return [NodeWithScore(node=n, score=s) for n, s in zip(nodes, scores)]

# after
class MyStore(SimplePropertyGraphStore):
    def vector_query(self, query):
        return nodes, scores  # exactly two sequences
Defensive patterns

Strategy: validation

Validate before calling

result = graph_store.vector_query(vector_store_query)
assert isinstance(result, tuple) and len(result) == 2, (
    'vector_query must return (nodes, scores); add a conformance test for custom stores'
)

Type guard

def is_valid_vector_result(result) -> bool:
    return (
        isinstance(result, (tuple, list)) and len(result) == 2
        and isinstance(result[0], list)
    )

Try / catch

try:
    nodes = retriever.retrieve_from_graph(qb)
except ValueError as e:
    if 'vector_query' in str(e):
        # bug in custom store: fix vector_query to return (nodes, scores)
        raise

Prevention

When it happens

Trigger: 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.

Common situations: 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.

Related errors


AI-assisted analysis of run-llama/llama_index@afd0fef371 (2026-08-15). Data as JSON: /api/errors/73bc97d13865a88d. Report an issue: GitHub.