SessionStart hook error: EEXIST when creating plugin data directory

Resolved 💬 3 comments Opened Apr 20, 2026 by LuizPaluski Closed Apr 24, 2026

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

  1. Install the claude-mem plugin from thedotmack
  2. Start a Claude Code session (the plugin data directory is created)
  3. Start any subsequent session
  4. The EEXIST error 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@thedotmack v12.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.

View original on GitHub ↗

This issue has 3 comments on GitHub. Read the full discussion on GitHub ↗