The bug shows up on the self-hosted Docker deployment described in the article. The stack uses three containers:
mem0/mem0-api-server:latest(mem0ai v0.1.117 at time of testing)ankane/pgvector:v0.5.1neo4j:5.26.4
The official image is missing a few runtime dependencies, so the Dockerfile installs them on top:
FROM mem0/mem0-api-server:latest
RUN pip install --no-cache-dir "psycopg[binary,pool]" "mem0ai[graph]" rank-bm25 langchain-neo4j neo4jThe full docker-compose.yaml is here: https://gist.github.com/BexTuychiev/2597529900335a66265dff5955f1cebf
Once the three files (.env, Dockerfile, docker-compose.yaml) are in place:
docker compose up -d --buildWait for all three containers to report healthy, then confirm the API responds:
curl -s http://localhost:8888/
# Should return a 307 redirect to /docscurl -s -X POST http://localhost:8888/memories \
-H "Content-Type: application/json" \
-d '{
"messages": [{"role": "user", "content": "I love hiking in the Rockies."}],
"user_id": "test_user"
}'Grab one of the memory IDs from the response.
curl -s -X PUT http://localhost:8888/memories/<memory_id> \
-H "Content-Type: application/json" \
-d '{"text": "Loves hiking in Colorado"}'Response:
{"detail": "'dict' object has no attribute 'replace'"}HTTP status: 500. The request body field name doesn't matter. {"text": "..."}, {"memory": "..."}, {"data": "..."} all produce the same error.
File "/app/main.py", line 164, in update_memory
return MEMORY_INSTANCE.update(memory_id=memory_id, data=updated_memory)
File "/usr/local/lib/python3.12/site-packages/mem0/memory/main.py", line 746, in update
existing_embeddings = {data: self.embedding_model.embed(data, "update")}
File "/usr/local/lib/python3.12/site-packages/mem0/embeddings/openai.py", line 44, in embed
text = text.replace("\n", " ")
AttributeError: 'dict' object has no attribute 'replace'
The FastAPI handler in /app/main.py declares the parameter as a dict:
@app.put("/memories/{memory_id}", summary="Update a memory")
def update_memory(memory_id: str, updated_memory: Dict[str, Any]):
...
return MEMORY_INSTANCE.update(memory_id=memory_id, data=updated_memory)But Memory.update() expects data to be a plain string:
def update(self, memory_id, data):
# data (str): New content to update the memory with.
existing_embeddings = {data: self.embedding_model.embed(data, "update")}The handler passes the parsed JSON body (a dict) straight into Memory.update(), which hands it to the embedding model. The embedding model calls .replace("\n", " ") on it, and that fails because dicts don't have a .replace() method.
mem0ai: 0.1.117mem0/mem0-api-server: latest tag as of Feb 19, 2026- Python: 3.12 (inside the container)