Windows: Marketplace update permanently wedged by stale .bak directory (EPERM rename loop)
Environment
- Windows 10, Claude Code 2.1.101 (native), Git Bash shell
Problem
On Windows, claude plugin marketplace update gets permanently stuck after a single failed update. Every subsequent update attempt (including automatic startup syncs) fails silently, leaving all installed plugins in "failed to load" state.
Root cause
The marketplace update algorithm does a rename dance:
- Fetch fresh content to
<name>.staging/ - Move current
<name>/→<name>.bak/ - Move
<name>.staging/→<name>/
If any step fails, rollback tries: rename <name>.bak/ → <name>/
On Windows, fs.rename() returns EPERM when the destination directory already exists (unlike POSIX). Once a .bak/ directory is left behind from a failed attempt, every future update fails because:
- Step 2 can't rename live → .bak (destination exists)
- Rollback can't rename .bak → live (live still exists since step 2 failed)
.staging/gets re-fetched every session but never promoted
Symptoms
/doctorreports all installed plugins as "not found in marketplace"claude plugin listshows all plugins as "✘ failed to load"- Error:
EPERM: operation not permitted, rename '...claude-plugins-official.bak' -> '...claude-plugins-official'
Fix applied manually
Deleted stale .bak/ directory, then claude plugin marketplace update succeeded immediately (log even said "Found stale directory, cleaning up and re-cloning").
Suggested fix
Before the rename dance, delete any pre-existing .bak/ directory (or use a unique temp name). The .bak/ is just a rollback buffer — stale ones from prior runs have no value and should be cleaned up.
This issue has 5 comments on GitHub. Read the full discussion on GitHub ↗