Description
When using Mem0 v1.0.1 with Qdrant (local) as the vector store and Ollama for embeddings/LLM, calling memory.delete(memory_id) fails with an AttributeError.
Environment
- Mem0 version: 1.0.1
- Python version: 3.13
- Vector store: Qdrant (local mode)
- Embedder: Ollama (nomic-embed-text)
- LLM: Ollama (llama3.2:latest)
- OS: macOS
Steps to Reproduce
- Configure Mem0 with Qdrant local storage:
from mem0 import Memory
config = {
'vector_store': {
'provider': 'qdrant',
'config': {
'collection_name': 'test_memories',
'embedding_model_dims': 768,
'path': './data'
}
},
'embedder': {
'provider': 'ollama',
'config': {
'model': 'nomic-embed-text',
'ollama_base_url': 'http://localhost:11434'
}
},
'llm': {
'provider': 'ollama',
'config': {
'model': 'llama3.2:latest',
'temperature': 0.1,
'ollama_base_url': 'http://localhost:11434'
}
}
}
m = Memory.from_config(config_dict=config)
- Add a memory:
result = m.add("User prefers concise writing style", user_id="test_user")
# Returns: {'results': [{'id': 'abc-123-...', 'memory': '...', 'event': 'ADD'}]}
- Try to delete the memory:
m.delete('abc-123-...') # Use the ID from step 2
Expected Behavior
The memory should be deleted successfully.
Actual Behavior
Traceback (most recent call last):
File "<string>", line 34, in <module>
m.delete('c0ff5fa9-8720-4629-b7fa-66040495411e')
File ".../mem0/memory/main.py", line 1022, in delete
self._delete_memory(memory_id)
File ".../mem0/memory/main.py", line 1199, in _delete_memory
prev_value = existing_memory.payload.get("data", "")
AttributeError: 'NoneType' object has no attribute 'payload'
Analysis
The error occurs in _delete_memory() at line 1199. It seems the code assumes existing_memory is always a valid object, but it returns None when the memory is not found in the vector store.
Possible fix: Add a null check before accessing existing_memory.payload:
def _delete_memory(self, memory_id):
existing_memory = self.vector_store.get(memory_id)
if existing_memory is None:
raise ValueError(f"Memory with id {memory_id} not found")
prev_value = existing_memory.payload.get("data", "")
# ... rest of the function
Additional Context
memory.add() works correctly and returns valid memory IDs
memory.get_all(user_id=...) returns the memories correctly
- Only
memory.delete() fails
Thank you for this great project!
Description
When using Mem0 v1.0.1 with Qdrant (local) as the vector store and Ollama for embeddings/LLM, calling
memory.delete(memory_id)fails with anAttributeError.Environment
Steps to Reproduce
Expected Behavior
The memory should be deleted successfully.
Actual Behavior
Analysis
The error occurs in
_delete_memory()at line 1199. It seems the code assumesexisting_memoryis always a valid object, but it returnsNonewhen the memory is not found in the vector store.Possible fix: Add a null check before accessing
existing_memory.payload:Additional Context
memory.add()works correctly and returns valid memory IDsmemory.get_all(user_id=...)returns the memories correctlymemory.delete()failsThank you for this great project!