Plugin loader errors when cache directory is deleted by concurrent update

Resolved 💬 2 comments Opened Jun 2, 2026 by HurleySk Closed Jun 2, 2026

Summary

When claude plugin update or /reload-plugins updates a plugin, the old version's cache directory is deleted while other active sessions still reference it. Those sessions then fail with:

Failed to run: Plugin directory does not exist: C:\Users\shurley\.claude\plugins\cache\hurleysk-marketplace\skill-engine\5.1.7
(skill-engine@hurleysk-marketplace — run /plugin to reinstall)

This is a race condition between plugin cache cleanup and active session plugin resolution.

Reproduction

  1. Open two Claude Code sessions (Session A, Session B)
  2. In Session A, run /reload-plugins or claude plugin update <plugin> where a newer version is available
  3. In Session B, trigger any plugin hook (e.g., start a new conversation that fires SessionStart)
  4. Session B errors because the old cache directory was deleted

Root Cause

installed_plugins.json records each plugin's installPath including the version:

{
  "installPath": "C:\\Users\\shurley\\.claude\\plugins\\cache\\hurleysk-marketplace\\skill-engine\\5.1.8",
  "version": "5.1.8"
}

When a plugin update runs:

  1. New version directory is created (e.g., 5.1.9/)
  2. Old version directory is deleted (e.g., 5.1.8/)
  3. installed_plugins.json is updated to point to the new path

But other sessions that were started before the update have the old path cached in memory. When they try to load plugin hooks, they reference the deleted directory.

Evidence: checking all installed plugin cache directories shows most plugins retain only 1 version, confirming old directories are deleted during updates:

ebay-resale:     1 version  -> 0.2.0
gantt:           3 versions -> 1.1.5, 1.1.6, 1.1.7  (exception)
skill-engine:    1 version  -> 5.1.8
superpowers:     1 version  -> 5.1.0

Expected Behavior

One of:

  • Don't delete old cache directories while active sessions reference them (ref-counting)
  • Gracefully handle missing directories — re-resolve to latest available version instead of erroring
  • Defer cleanup of old cache directories to session end rather than update time
  • Signal active sessions to refresh their plugin paths after an update

Impact

This affects plugin authors who frequently release new versions and tend to have multiple sessions open. Every release creates a window where existing sessions break.

Environment

  • Windows 11 Pro
  • Claude Code (Desktop + CLI)
  • Plugin: skill-engine@hurleysk-marketplace (frequent releases)

View original on GitHub ↗

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