{"record":{"id":"7941e5334c4d3db5","repo":"run-llama/llama_index","slug":"expected-vector-index-to-be-an-instance-of-vecto","errorCode":null,"errorMessage":"Expected 'vector_index' to be an instance of VectorStoreIndex, got {type(value)}","messagePattern":"Expected 'vector_index' to be an instance of VectorStoreIndex, got (.+?)","errorType":"validation","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"llama-index-core/llama_index/core/memory/vector_memory.py","lineNumber":84,"sourceCode":"    # If this is on, then any message that's not a user message will be combined with the last user message\n    # in the vector store.\n    batch_by_user_message: bool = True\n\n    cur_batch_textnode: TextNode = Field(\n        default_factory=_get_starter_node_for_new_batch,\n        description=\"The super node for the current active user-message batch.\",\n    )\n\n    @field_validator(\"vector_index\")\n    @classmethod\n    def validate_vector_index(cls, value: Any) -> Any:\n        \"\"\"Validate vector index.\"\"\"\n        # NOTE: we can't import VectorStoreIndex directly due to circular imports,\n        # which is why the type is Any\n        from llama_index.core.indices.vector_store import VectorStoreIndex\n\n        if not isinstance(value, VectorStoreIndex):\n            raise ValueError(\n                f\"Expected 'vector_index' to be an instance of VectorStoreIndex, got {type(value)}\"\n            )\n        return value\n\n    @classmethod\n    def class_name(cls) -> str:\n        \"\"\"Get class name.\"\"\"\n        return \"VectorMemory\"\n\n    @classmethod\n    def from_defaults(\n        cls,\n        vector_store: Optional[BasePydanticVectorStore] = None,\n        embed_model: Optional[EmbedType] = None,\n        index_kwargs: Optional[Dict] = None,\n        retriever_kwargs: Optional[Dict] = None,\n        **kwargs: Any,\n    ) -> \"VectorMemory\":","sourceCodeStart":66,"sourceCodeEnd":102,"githubUrl":"https://github.com/run-llama/llama_index/blob/afd0fef371831f9bda13e5af7167cf4e981278ab/llama-index-core/llama_index/core/memory/vector_memory.py#L66-L102","documentation":"Error \"Expected 'vector_index' to be an instance of VectorStoreIndex, got {type(value)}\" thrown in run-llama/llama_index.","triggerScenarios":"Thrown at llama-index-core/llama_index/core/memory/vector_memory.py:84 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Pass a VectorStoreIndex instance as vector_index.","Build a VectorStoreIndex from your nodes first and pass it to VectorMemory."],"exampleFix":null,"handlingStrategy":null,"validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"afd0fef371831f9bda13e5af7167cf4e981278ab","analyzedAt":"2026-08-15T05:42:58.429Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}