Plugin cache lost after CLI auto-update (local/third-party plugins not restored)

Resolved 💬 2 comments Opened Apr 16, 2026 by cokoro Closed May 25, 2026

Bug Description

After Claude Code auto-updates (e.g., 2.1.90 → 2.1.110), the ~/.claude/plugins/cache/ directory is wiped. Plugins installed from local directory sources and third-party marketplaces are not automatically restored, causing all non-official plugins to silently disappear.

settings.json still contains the enabledPlugins and statusLine entries pointing to the now-deleted cache paths, so the user sees no error — features just stop working.

Steps to Reproduce

  1. Install plugins from a local directory marketplace source:

``json
"extraKnownMarketplaces": {
"my-plugins": {
"source": { "source": "directory", "path": "/path/to/local/plugins" }
}
}
``

  1. Also install a third-party plugin not from an official marketplace (e.g., claude-statusline-hud)
  2. Close Claude Code
  3. Reopen — CLI auto-updates to a new version
  4. All locally-sourced and third-party plugins are gone from ~/.claude/plugins/cache/

Expected Behavior

  • Plugin cache should survive CLI upgrades
  • If cache must be rebuilt, plugins should be automatically reinstalled from their registered sources in installed_plugins.json and extraKnownMarketplaces
  • At minimum, the user should be notified that plugins were removed

Actual Behavior

  • ~/.claude/plugins/cache/ is cleared during upgrade
  • installed_plugins.json entries become orphaned (point to non-existent paths)
  • enabledPlugins in settings.json still references the missing plugins
  • No error or warning is shown — plugins silently stop working
  • statusLine command path breaks silently

Impact

In my case, 18+ plugins were lost, including:

  • All local marketplace plugins (ai-review-reporter, browser-automator, slack-mcp, kusto-query, etc.)
  • claude-statusline-hud (third-party)
  • memex (local directory source)
  • claude-mem (GitHub source)

Root Cause Analysis

From reading the minified cli.js, the plugin autoupdate flow appears to delete the old cache entry before attempting reinstallation. If reinstallation fails (e.g., local directory source not accessible, network issues for GitHub sources), the cache is already gone with no rollback.

Suggested Fix

  1. Don't delete cache during CLI upgrade~/.claude/plugins/cache/ is user data, not a disposable cache. CLI binary updates should not touch it.
  1. Backup-before-delete pattern in the plugin update function:

``javascript
async function updatePlugin(name, scope) {
const oldPath = getCachePath(name, oldVersion);
const backupPath = oldPath + '.bak';
renameSync(oldPath, backupPath); // backup first
try {
const result = await installFromSource(name);
if (result.success) {
rmSync(backupPath, { recursive: true }); // success -> delete backup
} else {
renameSync(backupPath, oldPath); // fail -> restore
}
} catch (e) {
renameSync(backupPath, oldPath); // error -> restore
}
}
``

  1. Add a claude plugins restore command that rebuilds cache from installed_plugins.json + registered sources.
  1. Startup integrity check: on launch, compare installed_plugins.json entries against actual cache contents. If mismatched, attempt re-install from source before giving up.

Environment

  • OS: Windows 11 Enterprise
  • Claude Code: upgraded from 2.1.90 → 2.1.110 (auto-update via winget)
  • Install method: winget (Anthropic.ClaudeCode)
  • Plugin sources: local directory, GitHub, third-party marketplace

View original on GitHub ↗

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