Plugin auto-update deletes old cache dir, breaking ${CLAUDE_PLUGIN_ROOT} in running sessions
Resolved 💬 4 comments Opened Apr 12, 2026 by Handtomouse Closed May 24, 2026
Summary
When a plugin auto-updates on session start, the old cache directory is deleted and replaced with a new hash-versioned directory. Any already-running session that resolved ${CLAUDE_PLUGIN_ROOT} at startup continues pointing to the deleted path, causing every hook invocation to fail.
Steps to reproduce
- Start a Claude Code session (session A)
- Start a second session (session B) — this triggers plugin auto-update if upstream changed
- Return to session A and use any tool
- Every hookify hook fails:
Plugin directory does not exist: .../hookify/<old_hash>
Impact
- Affects any plugin that registers hooks (hookify is the primary one)
- Error fires on every PreToolUse, PostToolUse, and Stop event — dozens of errors per conversation
- Non-blocking but very noisy, and the error message tells users to reinstall when the plugin is already current
Observed behavior
Plugin cache hashes observed changing multiple times in a single day:
03804b3b2735->a7a83f99ce07->150430d80202
Each transition broke all running sessions referencing the previous hash.
Suggested fixes
- Keep old cache dirs for a grace period (e.g. 24h) instead of deleting immediately
- Re-resolve
${CLAUDE_PLUGIN_ROOT}on each hook invocation rather than caching at session start - Symlink old -> new during update (this is my current workaround via a SessionStart hook)
Workaround
Created a SessionStart hook that records plugin hashes to a history file and creates symlinks from old hashes to the current version:
ln -s <new_hash> ~/.claude/plugins/cache/claude-plugins-official/hookify/<old_hash>
Environment
- Claude Code 2.1.104
- macOS Darwin 23.4.0
- hookify@claude-plugins-official
This issue has 4 comments on GitHub. Read the full discussion on GitHub ↗