[BUG] Plugin marketplace tilde expansion: literal ~ dirs created in every project directory

Resolved 💬 3 comments Opened Mar 4, 2026 by coygeek Closed Apr 2, 2026

Description

The plugin marketplace system stores installLocation paths with a literal ~ in ~/.claude/plugins/known_marketplaces.json. When the marketplace refresh runs, Node.js does not expand ~ (tilde expansion is a shell feature, not a Node.js feature). As a result, git clone and mkdir create a literal directory named ~ relative to the current working directory.

Every project directory where a Claude Code session has run accumulates a garbage ~/Desktop/<project>/~/.claude/plugins/marketplaces/... tree, consuming significant disk space.

Environment

  • Claude Code version: v2.1.68
  • Platform: macOS (darwin)
  • Confirmed still reproducing in v2.1.68

Reproduction Steps

  1. Open Claude Code in any project directory (e.g. ~/Desktop/WIP/my-project).
  2. Trigger a plugin marketplace refresh (happens automatically on session start).
  3. Observe that a literal directory named ~ is created in the project working directory: ~/Desktop/WIP/my-project/~/.claude/plugins/marketplaces/...
  4. The garbage tree replicates the full marketplace clone under the literal-~ path.

Root Cause

In known_marketplaces.json, installLocation values are stored as "~/.claude/plugins/marketplaces/<name>". The marketplace refresh code passes this path directly to git clone / mkdir (e.g., via something like re()) without expanding ~ to os.homedir(). Node.js does not perform tilde expansion, so the shell-syntax ~ is treated as a literal directory name.

Example known_marketplaces.json showing the problem:

{
  "anthropic-agent-skills": {
    "source": { "source": "github", "repo": "anthropics/skills" },
    "installLocation": "~/.claude/plugins/marketplaces/anthropic-agent-skills",
    "lastUpdated": "2026-03-04T18:32:44.201Z"
  },
  "claude-plugins-official": {
    "source": { "source": "github", "repo": "anthropics/claude-plugins-official" },
    "installLocation": "~/.claude/plugins/marketplaces/claude-plugins-official",
    "lastUpdated": "2026-03-04T18:21:28.283Z"
  }
}

The fix is to resolve installLocation values through path.resolve(installLocation.replace(/^~/, os.homedir())) (or equivalent) before passing them to any filesystem/git operation.

Impact

  • 10 literal ~ directories were found under ~/Desktop/WIP, consuming ~63.8MB of disk space.
  • The largest single garbage tree was 24MB.
  • The issue affects every project directory where a session runs, silently accumulating waste.
  • Garbage directories contaminate git add . operations in affected projects.

Workaround

Manually patch known_marketplaces.json to use absolute paths:

sed -i '' "s|\"~/.claude/|\"$HOME/.claude/|g" ~/.claude/plugins/known_marketplaces.json

This is a best-effort workaround; Claude Code may overwrite the file with ~-prefixed paths on the next marketplace operation.

Related Issues

  • #17354 (closed — still reproducing in v2.1.68)
  • #21868 (closed — still reproducing in v2.1.68)

Both prior issues were closed but the bug persists. This is a new report confirming reproduction on the current release.

View original on GitHub ↗

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