Describe the bug
POST /api/v2/memories to a project that has just been deleted (or whose deletion is racing the add) returns 500.
SessionDeletedError is raised in packages/server/src/memmachine_server/episodic_memory/episodic_memory_manager.py (lines 156 and 266), but server/api_v2/exceptions.py maps only SessionNotFoundError, and add_memories (server/api_v2/router.py) catches nothing, so the error reaches the client as an unhandled 500.
Steps to reproduce
POST /api/v2/projects/delete {"org_id": "o", "project_id": "p"} -> 204
POST /api/v2/memories {"org_id": "o", "project_id": "p", "messages": [...]} -> 500
Server log: SessionDeletedError: Session 'o/p' has been deleted.
Expected behavior
A mapped client error: 404 (the project no longer exists, as after the purge completes) or 409/503 (it is being deleted).
Environment
- OS: Linux (Ubuntu 24.04), Docker
- MemMachine Version:
main at c99bc0e (0.3.9+50.gc99bc0e), image built from source; also seen at c08cf26
- Development language version: Python 3.12 (in the image)
- Backend: event memory, PostgreSQL 18, Qdrant 1.19.1
Additional context
Suggested fix: map SessionDeletedError in exceptions.py alongside SessionNotFoundError.
Describe the bug
POST /api/v2/memoriesto a project that has just been deleted (or whose deletion is racing the add) returns500.SessionDeletedErroris raised inpackages/server/src/memmachine_server/episodic_memory/episodic_memory_manager.py(lines 156 and 266), butserver/api_v2/exceptions.pymaps onlySessionNotFoundError, andadd_memories(server/api_v2/router.py) catches nothing, so the error reaches the client as an unhandled500.Steps to reproduce
Server log:
SessionDeletedError: Session 'o/p' has been deleted.Expected behavior
A mapped client error:
404(the project no longer exists, as after the purge completes) or409/503(it is being deleted).Environment
mainatc99bc0e(0.3.9+50.gc99bc0e), image built from source; also seen atc08cf26Additional context
Suggested fix: map
SessionDeletedErrorinexceptions.pyalongsideSessionNotFoundError.