run-llama/llama_index · error · ValueError
Cannot initialize from a vector store that does not store te
Error message
Cannot initialize from a vector store that does not store text.
What it means
VectorStoreIndex.from_vector_store raises ValueError('Cannot initialize from a vector store that does not store text.') when vector_store.stores_text is False. This classmethod builds an index purely from a vector store with empty nodes, which only works if the store can return full text nodes at query time; stores like Chroma in some modes, or metadata-only configurations, keep only embeddings+ids and rely on a local docstore, so they cannot back a from_vector_store round trip.
Source
Thrown at llama-index-core/llama_index/core/indices/vector_store/base.py:94
nodes=nodes,
index_struct=index_struct,
storage_context=storage_context,
show_progress=show_progress,
objects=objects,
callback_manager=callback_manager,
transformations=transformations,
**kwargs,
)
@classmethod
def from_vector_store(
cls,
vector_store: BasePydanticVectorStore,
embed_model: Optional[EmbedType] = None,
**kwargs: Any,
) -> "VectorStoreIndex":
if not vector_store.stores_text:
raise ValueError(
"Cannot initialize from a vector store that does not store text."
)
kwargs.pop("storage_context", None)
storage_context = StorageContext.from_defaults(vector_store=vector_store)
return cls(
nodes=[],
embed_model=embed_model,
storage_context=storage_context,
**kwargs,
)
@property
def vector_store(self) -> BasePydanticVectorStore:
return self._vector_store
def as_retriever(self, **kwargs: Any) -> BaseRetriever:View on GitHub (pinned to afd0fef371)
Solutions
- If the store actually holds node payloads, set stores_text=True on it (custom stores) or upgrade the integration that reported it wrong.
- If text genuinely lives elsewhere, build the index with a docstore-backed flow: VectorStoreIndex(nodes, storage_context=StorageContext.from_defaults(vector_store=store, docstore=docstore)) instead of from_vector_store.
- For a fresh start, ingest through llama-index so nodes are stored, then re-check stores_text.
Example fix
# before index = VectorStoreIndex.from_vector_store(store) # store.stores_text == False # after from llama_index.core.storage.storage_context import StorageContext storage = StorageContext.from_defaults(vector_store=store, docstore=docstore) index = VectorStoreIndex(nodes=[], storage_context=storage)
Defensive patterns
Strategy: type-guard
Validate before calling
def can_init_from_vector_store(store) -> bool:
return bool(getattr(store, "stores_text", False)) Type guard
from llama_index.core.vector_stores.types import BasePydanticVectorStore
def stores_text(store: BasePydanticVectorStore) -> bool:
return bool(store.stores_text) Prevention
- Check vector_store.stores_text before calling VectorStoreIndex.from_vector_store.
- For id-only stores, build the index via StorageContext with an explicit docstore instead.
- Custom store authors: set stores_text=True only if the store actually returns full text nodes.
When it happens
Trigger: VectorStoreIndex.from_vector_store(my_store) where my_store.stores_text is False — typical for some community integrations or custom stores; switching an integration version whose stores_text default flipped to False; constructing a fresh index object over a pre-populated id-only store.
Common situations: Pointing llama-index at an externally populated vector DB that never stored node text; upgrading integration packages where stores_text became accurate/False; custom BasePydanticVectorStore subclasses forgetting to set stores_text=True when they do store text.
Related errors
- Must provide either user_msg or chat_history
- embeddings_cache must be of type BaseKVStore
- embeddings_cache must be defined
- Did not find {key}, please add an environment variable `{env
- Cannot add two handlers of the same type {type(new_handler)}
AI-assisted analysis of run-llama/llama_index@afd0fef371 (2026-08-15).
Data as JSON: /api/errors/a165a0147464ac11.
Report an issue: GitHub.