mem0ai/mem0 · error · ValueError
Existing record {vector_id} has no vector data
Error message
Existing record {vector_id} has no vector data What it means
Thrown by MilvusVectorStore.update() when the caller omitted the vector and the existing Milvus record it just fetched has no 'vectors' field. The update path needs the old embedding to re-upsert the full schema, so a record stored without an embedding cannot be updated this way.
Source
Thrown at mem0/vector_stores/milvus.py:297
self.client.delete(collection_name=self.collection_name, ids=[vector_id])
def update(self, vector_id=None, vector=None, payload=None):
"""
Update a vector and its payload.
Args:
vector_id (str): ID of the vector to update.
vector (List[float], optional): Updated vector.
payload (Dict, optional): Updated payload.
"""
if vector is None or payload is None:
existing = self.client.get(collection_name=self.collection_name, ids=vector_id)
if not existing:
raise ValueError(f"Vector with id {vector_id} not found in collection {self.collection_name}")
if vector is None:
vector = existing[0].get("vectors")
if vector is None:
raise ValueError(f"Existing record {vector_id} has no vector data")
if payload is None:
payload = existing[0].get("metadata")
schema = {"id": vector_id, "vectors": vector, "metadata": payload}
if self._has_bm25_schema:
text = ""
if payload:
text = (payload.get("text_lemmatized") or payload.get("data", ""))[:65535]
schema["text"] = text
self.client.upsert(collection_name=self.collection_name, data=schema)
def get(self, vector_id) -> Optional[OutputData]:
"""
Retrieve a vector by ID.
Args:
vector_id (str): ID of the vector to retrieve.
View on GitHub (pinned to 001c235229)
Solutions
- Pass the vector explicitly: update(vector_id=X, vector=<freshly embedded vector>, payload=new_payload)
- Regenerate the embedding for the source text and re-insert the record properly with both vector and payload
- Audit how the record got in without a vector (insert path or manual write) and fix that writer
Example fix
// before store.update(vector_id=vid, payload=new_payload) # record has no vector // after vec = embedder.embed(new_payload["data"]) store.update(vector_id=vid, vector=vec, payload=new_payload)
Defensive patterns
Strategy: validation
Validate before calling
record = milvus_store.get(vector_id)
if record is None or record.payload is None:
raise ValueError("record missing; re-insert instead of update")
if vector is None:
vector = record.payload.get("embedding") or embedder.embed(text)
if not vector:
raise ValueError("cannot reconstruct embedding; supply vector explicitly")
store.update(vector_id=vector_id, vector=vector, payload=payload) Type guard
def has_embedding(rec) -> bool:
return rec is not None and rec.vector is not None and len(rec.vector) > 0 Try / catch
try:
store.update(vector_id=vid, payload=p)
except ValueError as e:
if "has no vector data" in str(e):
store.update(vector_id=vid, vector=embedder.embed(p["data"]), payload=p)
else:
raise Prevention
- Always insert records with both vector and payload
- Pass vector explicitly on update when you have the source text available
- Reject writes that produce None embeddings at insert time
When it happens
Trigger: Calling update(vector_id=X, vector=None, payload={...}) on a record that was inserted with a null/missing vector (e.g. a BM25-only or payload-only row), or on a schema where the vector field is nullable and was skipped at insert time.
Common situations: Collections created for hybrid/BM25 search where some rows carry only text; data migrated or hand-inserted into Milvus without embeddings; embeddings that silently failed to generate at insert time.
Related errors
- Invalid filter key: ${JSON.stringify(key)}
- Filter value for ${JSON.stringify(key)} must be a string, nu
- The 'pymilvus' library is required. Please install it using
- Vector with id {vector_id} not found in collection {self.col
- Failed to auto-detect embedding dimension from provider '${t
AI-assisted analysis of mem0ai/mem0@001c235229 (2026-08-15).
Data as JSON: /api/errors/91b8c262ab605bbe.
Report an issue: GitHub.