SessionStart hook error: EEXIST when creating plugin data directory
Bug Description
On every session start, Claude Code throws a SessionStart hook error because it attempts to create the plugin data directory using mkdir without the recursive flag, causing an EEXIST error when the directory already exists from a previous session.
Error Message
SessionStart:startup hook error Failed to run: EEXIST: file already exists, mkdir 'C:\Users\<user>\.claude\plugins\data\claude-mem-thedotmack'
Steps to Reproduce
- Install the
claude-memplugin fromthedotmack - Start a Claude Code session (the plugin data directory is created)
- Start any subsequent session
- The
EEXISTerror appears on every session start from that point on
Root Cause
The Claude Code harness creates the plugin data directory (~/.claude/plugins/data/<plugin-name>) on each SessionStart using mkdir without the { recursive: true } option (or -p flag equivalent). Since the directory already exists after the first session, subsequent calls fail with EEXIST.
The fix should be to use mkdirSync(dataDir, { recursive: true }) instead of plain mkdirSync(dataDir) when creating plugin data directories — this is a no-op if the directory already exists.
Environment
- OS: Windows 11 Pro 10.0.26200
- Shell: bash (WSL)
- Plugin:
claude-mem@thedotmackv12.3.7
Impact
The error is cosmetic only — the plugin works correctly since the directory already exists in the correct state. However, the repeated error message appears on every session start and is confusing to users.
This issue has 3 comments on GitHub. Read the full discussion on GitHub ↗