run-llama/llama_index · error · ValueError
Expected 'vector_index' to be an instance of VectorStoreInde
Error message
Expected 'vector_index' to be an instance of VectorStoreIndex, got {type(value)} What it means
Error "Expected 'vector_index' to be an instance of VectorStoreIndex, got {type(value)}" thrown in run-llama/llama_index.
Source
Thrown at llama-index-core/llama_index/core/memory/vector_memory.py:84
# If this is on, then any message that's not a user message will be combined with the last user message
# in the vector store.
batch_by_user_message: bool = True
cur_batch_textnode: TextNode = Field(
default_factory=_get_starter_node_for_new_batch,
description="The super node for the current active user-message batch.",
)
@field_validator("vector_index")
@classmethod
def validate_vector_index(cls, value: Any) -> Any:
"""Validate vector index."""
# NOTE: we can't import VectorStoreIndex directly due to circular imports,
# which is why the type is Any
from llama_index.core.indices.vector_store import VectorStoreIndex
if not isinstance(value, VectorStoreIndex):
raise ValueError(
f"Expected 'vector_index' to be an instance of VectorStoreIndex, got {type(value)}"
)
return value
@classmethod
def class_name(cls) -> str:
"""Get class name."""
return "VectorMemory"
@classmethod
def from_defaults(
cls,
vector_store: Optional[BasePydanticVectorStore] = None,
embed_model: Optional[EmbedType] = None,
index_kwargs: Optional[Dict] = None,
retriever_kwargs: Optional[Dict] = None,
**kwargs: Any,
) -> "VectorMemory":View on GitHub (pinned to afd0fef371)
Solutions
- Pass a VectorStoreIndex instance as vector_index.
- Build a VectorStoreIndex from your nodes first and pass it to VectorMemory.
When it happens
Trigger: Thrown at llama-index-core/llama_index/core/memory/vector_memory.py:84 when the library encounters an invalid state.
Common situations: See trigger scenarios.
AI-assisted analysis of run-llama/llama_index@afd0fef371 (2026-08-15).
Data as JSON: /api/errors/7941e5334c4d3db5.
Report an issue: GitHub.