run-llama/llama_index · error · ValueError
Vector store query result should return at least one of node
Error message
Vector store query result should return at least one of nodes or ids.
What it means
DocumentSummaryIndexEmbeddingRetriever converts a vector store query result into summary ids using either query_result.ids or query_result.nodes. A conforming VectorStoreQueryResult must populate at least one; if both are None the retriever has nothing to map back to summaries and raises ValueError. This almost always indicates a custom or misbehaving vector store implementation rather than bad caller input.
Source
Thrown at llama-index-core/llama_index/core/indices/document_summary/retrievers.py:182
query_bundle.embedding = (
self._embed_model.get_agg_embedding_from_queries(
query_bundle.embedding_strs
)
)
query = VectorStoreQuery(
query_embedding=query_bundle.embedding,
similarity_top_k=self._similarity_top_k,
)
query_result = self._vector_store.query(query)
top_k_summary_ids: List[str]
if query_result.ids is not None:
top_k_summary_ids = query_result.ids
elif query_result.nodes is not None:
top_k_summary_ids = [n.node_id for n in query_result.nodes]
else:
raise ValueError(
"Vector store query result should return at least one of nodes or ids."
)
results = []
for summary_id in top_k_summary_ids:
node_ids = self._index_struct.summary_id_to_node_ids[summary_id]
nodes = self._docstore.get_nodes(node_ids)
results.extend([NodeWithScore(node=n) for n in nodes])
return results
# legacy, backward compatibility
DocumentSummaryIndexRetriever = DocumentSummaryIndexLLMRetriever
View on GitHub (pinned to afd0fef371)
Solutions
- Fix the custom vector store's query() to always set ids (and ideally nodes) on VectorStoreQueryResult before returning it.
- Test the store in isolation: res = store.query(VectorStoreQuery(query_embedding=emb, similarity_top_k=5)); assert res.ids or res.nodes.
- Switch to a battle-tested store (Chroma, Qdrant, FAISS, Postgres) to confirm the issue is store-specific.
- Return empty lists rather than None fields on zero hits so the retriever degrades gracefully.
Example fix
# before (custom store)
def query(self, q, **kwargs):
sims, ids = self._search(q.query_embedding, q.similarity_top_k)
return VectorStoreQueryResult(similarities=sims) # ids/nodes None -> ValueError downstream
# after
def query(self, q, **kwargs):
sims, ids = self._search(q.query_embedding, q.similarity_top_k)
return VectorStoreQueryResult(similarities=sims, ids=ids or []) Defensive patterns
Strategy: try-catch
Validate before calling
res = vector_store.query(VectorStoreQuery(query_embedding=emb, similarity_top_k=2)) assert res.ids is not None or res.nodes is not None, "store returns empty result objects"
Try / catch
try:
results = retriever.retrieve(query_str)
except ValueError as e:
if "nodes or ids" in str(e):
# vector store contract violation; log store type and retry with a known-good store
logger.error("vector store %s violates query-result contract", type(vector_store).__name__)
raise
raise Prevention
- Write a contract test for any custom vector store: query() must populate ids or nodes on VectorStoreQueryResult.
- Return empty lists instead of None for ids/nodes on zero-hit queries.
When it happens
Trigger: Using DocumentSummaryIndex(..., embed_summaries=True) with a custom VectorStore whose query() returns VectorStoreQueryResult(nodes=None, ids=None); a store wrapper that drops ids; an in-memory/simple store whose query is not fully implemented.
Common situations: Plugging in a custom or third-party vector store that returns only similarities or an empty result object; adapters that build VectorStoreQueryResult without copying ids from the backend response; empty-result edge cases where the store returns a bare result.
Related errors
- Cannot use embedding retriever if embed_summaries is False
- Unknown retriever mode: {retriever_mode}
- Vector store query result should return at least one of node
- No nodes returned by vector_query
- Node ID {node_id} not found in index.
AI-assisted analysis of run-llama/llama_index@afd0fef371 (2026-08-15).
Data as JSON: /api/errors/84741dae68f9a1fa.
Report an issue: GitHub.