Skip to content

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

Description

@bluerush-nuno

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

Field Value
Claude Code version v2.1.117 → reproduced on v2.1.118
OS Windows 11, Build 26200
Install method native 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 #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

Workaround Result
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\.claude Junction already existed; EPERM on rename still occurs
Manual deletion of temp_* and everything-claude-code dirs before retry Temp dir recreated on next attempt, rename fails again
Manual git clone into target path Workaround 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

Metadata

Metadata

Assignees

No one assigned

    Labels

    area:pluginsbugSomething isn't workingplatform:windowsIssue specifically occurs on WindowsstaleIssue is inactive

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions