claude-code - 💡(How to fix) Fix [BUG] [Windows] Plugin marketplace install fails with EPERM on rename — path resolution collapses username + .claude into single token [2 comments, 3 participants]

Official PRs (…)
ON THIS PAGE

Recommended Tools

×6

Utilities matched from this issue’s tags and category — try them while you read without losing context.

GitHub issue graph ai analysis

Paste a GitHub issue URL. We fetch that issue, discover linked issues from bodies/comments/timeline, collect linked pull requests, and produce a structured English report.

The report is written in English Markdown for sharing and archival.

Helpful · Quick feedback

Loading…
GitHub stats
anthropics/claude-code#52435Fetched 2026-04-24 06:07:19
View on GitHub
Comments
2
Participants
3
Timeline
6
Reactions
0
Timeline (top)
labeled ×3commented ×2cross-referenced ×1

On Windows, when a username contains no dots, Claude Code incorrectly resolves the config path by collapsing C:\Users\username and \.claude into C:\Users\username.claude\ — treating .claude as a suffix to the username rather than a subdirectory.

This manifests as an EPERM: operation not permitted, rename error when the marketplace installer attempts to atomically rename a temp directory to the final destination, because the resolved path is invalid/unexpected.

This happens even when CLAUDE_CONFIG_DIR is set to the right folder C:\Users\username.claude AND a symlink from C:\Users\username.claude -> C:\Users\username.claude exists.

Similar issue reported in https://github.com/anthropics/claude-code/issues/45432 but that is related to the username having accented characters.


Error Message

Error: Failed to finalize marketplace cache. Please manually delete the directory at C:\Users\username.claude\plugins\marketplaces\everything-claude-code if it exists and try again.

Technical details: EPERM: operation not permitted, rename 'C:\Users\username.claude\plugins\marketplaces\temp_1776882015473' -> 'C:\Users\username.claude\plugins\marketplaces\everything-claude-code'

Root Cause

Two distinct bugs appear to be present:

Bug 1 — Path resolution: ~\.claude is being resolved by stripping the separator, producing username.claude as a directory name rather than username\.claude as a subdirectory. The splash screen displays ~\.claude correctly, but the runtime path is wrong.

Bug 2 — Atomic rename: fs.rename() on Windows fails with EPERM when the destination directory already exists (from a prior failed attempt). Unlike POSIX, Windows does not support atomic directory rename-over-existing. The installer has no fallback for this case.


Fix Action

Fix / Workaround

Bug 1 — Path resolution: ~\.claude is being resolved by stripping the separator, producing username.claude as a directory name rather than username\.claude as a subdirectory. The splash screen displays ~\.claude correctly, but the runtime path is wrong.

Attempted Workarounds — All Unsuccessful

WorkaroundResult
Set CLAUDE_CONFIG_DIR=C:\Users\username\.claude (User env var)Fixes config dir but plugins path resolved independently — no effect on marketplace
NTFS junction: username.claudeusername\.claudeJunction already existed; EPERM on rename still occurs
Manual deletion of temp_* and everything-claude-code dirs before retryTemp dir recreated on next attempt, rename fails again
Manual git clone into target pathWorkaround only — does not fix the underlying issue

Code Example

Error: Failed to finalize marketplace cache. Please manually delete the directory at
C:\Users\username.claude\plugins\marketplaces\everything-claude-code if it exists and try again.

Technical details: EPERM: operation not permitted, rename
'C:\Users\username.claude\plugins\marketplaces\temp_1776882015473' ->
'C:\Users\username.claude\plugins\marketplaces\everything-claude-code'

---

### Error Output


Error: Failed to finalize marketplace cache. Please manually delete the directory at
C:\Users\username.claude\plugins\marketplaces\everything-claude-code if it exists and try again.

Technical details: EPERM: operation not permitted, rename
'C:\Users\username.claude\plugins\marketplaces\temp_1776882015473' ->
'C:\Users\username.claude\plugins\marketplaces\everything-claude-code'
RAW_BUFFERClick to expand / collapse

Preflight Checklist

  • I have searched existing issues and this hasn't been reported yet
  • This is a single bug report (please file separate reports for different bugs)
  • I am using the latest version of Claude Code

What's Wrong?

Title: [Windows] Plugin marketplace install fails with EPERM on rename — path resolution collapses username + .claude into single token

Labels: bug, windows, plugin-marketplace


Environment

FieldValue
Claude Code versionv2.1.117 → reproduced on v2.1.118
OSWindows 11, Build 26200
Install methodnative installer

Description

On Windows, when a username contains no dots, Claude Code incorrectly resolves the config path by collapsing C:\Users\username and \.claude into C:\Users\username.claude\ — treating .claude as a suffix to the username rather than a subdirectory.

This manifests as an EPERM: operation not permitted, rename error when the marketplace installer attempts to atomically rename a temp directory to the final destination, because the resolved path is invalid/unexpected.

This happens even when CLAUDE_CONFIG_DIR is set to the right folder C:\Users\username.claude AND a symlink from C:\Users\username.claude -> C:\Users\username.claude exists.

Similar issue reported in https://github.com/anthropics/claude-code/issues/45432 but that is related to the username having accented characters.


Steps to Reproduce

  1. Fresh Windows install of Claude Code (native, non-WSL)
  2. Run /plugin marketplace add https://github.com/affaan-m/everything-claude-code
  3. Observe failure

Error Output

Error: Failed to finalize marketplace cache. Please manually delete the directory at
C:\Users\username.claude\plugins\marketplaces\everything-claude-code if it exists and try again.

Technical details: EPERM: operation not permitted, rename
'C:\Users\username.claude\plugins\marketplaces\temp_1776882015473' ->
'C:\Users\username.claude\plugins\marketplaces\everything-claude-code'

Root Cause Analysis

Two distinct bugs appear to be present:

Bug 1 — Path resolution: ~\.claude is being resolved by stripping the separator, producing username.claude as a directory name rather than username\.claude as a subdirectory. The splash screen displays ~\.claude correctly, but the runtime path is wrong.

Bug 2 — Atomic rename: fs.rename() on Windows fails with EPERM when the destination directory already exists (from a prior failed attempt). Unlike POSIX, Windows does not support atomic directory rename-over-existing. The installer has no fallback for this case.


Attempted Workarounds — All Unsuccessful

WorkaroundResult
Set CLAUDE_CONFIG_DIR=C:\Users\username\.claude (User env var)Fixes config dir but plugins path resolved independently — no effect on marketplace
NTFS junction: username.claudeusername\.claudeJunction already existed; EPERM on rename still occurs
Manual deletion of temp_* and everything-claude-code dirs before retryTemp dir recreated on next attempt, rename fails again
Manual git clone into target pathWorkaround only — does not fix the underlying issue

Expected Behavior

  • ~\.claude resolves to C:\Users\username\.claude (subdirectory)
  • Marketplace installer handles pre-existing destination directory gracefully (delete-then-rename or copy-then-delete fallback)
  • CLAUDE_CONFIG_DIR controls all path resolution including plugins, not just config

Additional Notes

The EPERM on rename is a known Windows limitation with Node.js fs.rename() across certain directory states. The fix is either fs.rm() on the destination before rename, or using a copy+delete strategy instead of atomic rename on Windows.

What Should Happen?

Expected Behavior

  • ~\.claude resolves to C:\Users\username\.claude (subdirectory)
  • Marketplace installer handles pre-existing destination directory gracefully (delete-then-rename or copy-then-delete fallback)
  • CLAUDE_CONFIG_DIR controls all path resolution including plugins, not just config

Error Messages/Logs

### Error Output


Error: Failed to finalize marketplace cache. Please manually delete the directory at
C:\Users\username.claude\plugins\marketplaces\everything-claude-code if it exists and try again.

Technical details: EPERM: operation not permitted, rename
'C:\Users\username.claude\plugins\marketplaces\temp_1776882015473' ->
'C:\Users\username.claude\plugins\marketplaces\everything-claude-code'

Steps to Reproduce

Steps to Reproduce

  1. Fresh Windows install of Claude Code (native, non-WSL)
  2. Run /plugin marketplace add https://github.com/affaan-m/everything-claude-code
  3. Observe failure

Claude Model

Sonnet (default)

Is this a regression?

Yes, this worked in a previous version

Last Working Version

No response

Claude Code Version

2.1.118

Platform

Anthropic API

Operating System

Windows

Terminal/Shell

Windows Terminal

Additional Information

No response

extent analysis

TL;DR

The most likely fix involves modifying the path resolution to correctly handle the .claude directory and implementing a fallback strategy for the atomic rename operation on Windows.

Guidance

  • Verify that the CLAUDE_CONFIG_DIR environment variable is set correctly to C:\Users\username\.claude to ensure proper config directory resolution.
  • Consider using fs.rm() to delete the destination directory before attempting to rename, or implement a copy-then-delete strategy as a fallback for Windows.
  • Review the path resolution logic to ensure that ~\.claude is resolved to C:\Users\username\.claude as a subdirectory, rather than C:\Users\username.claude.
  • Test the marketplace installer with a clean directory to ensure that the issue is not related to pre-existing files or directories.

Example

// Example of using fs.rm() to delete the destination directory before rename
const fs = require('fs/promises');
const path = require('path');

const tempDir = 'C:\\Users\\username.claude\\plugins\\marketplaces\\temp_1776882015473';
const destDir = 'C:\\Users\\username.claude\\plugins\\marketplaces\\everything-claude-code';

try {
  await fs.rm(destDir, { recursive: true, force: true });
  await fs.rename(tempDir, destDir);
} catch (error) {
  console.error(error);
}

Notes

The provided example is a simplified illustration and may require modifications to fit the actual implementation. Additionally, the issue may be related to the specific version of Node.js or Windows being used.

Recommendation

Apply a workaround by using fs.rm() or a copy-then-delete strategy to handle the atomic rename operation on Windows, as the underlying issue is related to a known Windows limitation with Node.js fs.rename().

Vote matrix · Quick signals

Works
Did the solution work? Tap to confirm.
Easy Fix
Was it a quick fix?
Time Saver
Did it save you time?
Blocking
Was it severely blocking?
Common Issue
Are others likely hitting this too?
Flaky / Intermittent
Is it intermittent?
Verified / Reproducible
Can you reproduce it reliably?
Loading…

Still need to ship something?

×6

Another batch ranked right after the header list — different links, same matching logic.

Back to top recommendations

TRENDING