Repository navigation
Description
Which server?
memory (@modelcontextprotocol/server-memory)
Server version
2.2.2 (npm)
How did you run the server?
npx (npm package)
Transport
stdio
Protocol era
Legacy (2025-11-25 or earlier)
MCP client and version
Custom Python JSON-RPC stdio client (mcpfuse test harness)
Operating system and runtime
macOS 26.3.2, Node v25.9.0
Server configuration
MEMORY_FILE_PATH=/tmp/mem-repro/missing_dir/memory.jsonl \
npx -y @modelcontextprotocol/server-memory@2.2.2(where /tmp/mem-repro/missing_dir does not exist yet)
Steps to reproduce
- Ensure
/tmp/mem-repro/missing_dirdoes not exist. - Start the server with
MEMORY_FILE_PATH=/tmp/mem-repro/missing_dir/memory.jsonl. - Call
read_graphwith{}. - Call
create_entitieswith:(The same error occurs for every write tool:{ "entities": [ { "name": "Alice", "entityType": "person", "observations": ["hi"] } ] }create_relations,add_observations,delete_entities,delete_observations,delete_relations.)
Expected behavior
Consistent, user-friendly handling across read and write tools when MEMORY_FILE_PATH's parent directory does not exist: either create the missing parent directory on first write (e.g., fs.mkdir(path.dirname(memoryFilePath), { recursive: true }) before acquiring the lock), or fail cleanly at startup/call time with an actionable message naming MEMORY_FILE_PATH rather than leaking an internal .lock file path.
Actual behavior
read_graph(andopen_nodes/search_nodes) silently succeeds with{"entities": [], "relations": []}becauseloadGraphWithUnreadable()treatsENOENTas an empty graph — giving the client/model the impression that the store is ready.- Every write tool then fails immediately inside
withFileLock()(src/memory/index.ts,fs.open(lockPath, "wx")) with a raw Node filesystem error exposing the internal sibling lock path:
ENOENT: no such file or directory, open '/tmp/mem-repro/missing_dir/memory.jsonl.lock'.
Logs or error output
Step 1 (read_graph): isError=false
{
"entities": [],
"relations": []
}
Step 2 (create_entities): isError=true
ENOENT: no such file or directory, open '/tmp/mem-repro/missing_dir/memory.jsonl.lock'
Already prototyped a fix?
Per CONTRIBUTING.md (issues-only policy), I am not opening a pull request. Related context: lock-file management in #5485 / #5565, and a similar raw-ENOENT fix in filesystem (#5432).
Suggested prompt for fixing this:
In
src/memory/index.ts, handle the case whereMEMORY_FILE_PATH's parent directory does not exist consistently between read and write tools. Either ensure the parent directory exists (fs.mkdir(path.dirname(this.memoryFilePath), { recursive: true })) beforewithFileLockacquires${this.memoryFilePath}.lock, or if creating directories automatically is undesirable, catchENOENTonfs.open(lockPath, "wx")and throw a clear, actionable error explaining that the parent directory ofMEMORY_FILE_PATHdoes not exist (without exposing the internal.lockpath). Add unit tests coveringread_graphand write tools when the parent directory ofMEMORY_FILE_PATHis missing.
Before you submit
- I searched existing issues and this is not a duplicate.
- This is not a security vulnerability report (those go through the private advisory form).
Activity
cliffhall commentedon Nov 30, 2026
Triage: Priority Low (total 5)
ENOENTinstead of an actionable error when the parent directory ofMEMORY_FILE_PATHis missing; creating the directory works around itbuglabelBoard: Servers V2 (#43), Status
Incoming, awaiting maintainer review (no milestone yet).fix(memory): fail every tool with an actionable error when the memory…