[BUG] --plugin-dir does not take precedence over marketplace-installed plugin with same name

Status Closed — not planned
Reported on v2.1.195
Maintainer reply ✓ Yes — bcherny
Activity 5 comments · opened Jun 29, 2026 · closed Aug 24, 2026
💡 Likely answer: A maintainer (bcherny, collaborator) responded on this thread — see the highlighted reply below.

Preflight Checklist

  • [x] I have searched existing issues and this hasn't been reported yet
  • [x] This is a single bug report
  • [x] I am using the latest version of Claude Code

Bug Description

When running claude --plugin-dir=<path> with a plugin that has the same name as a marketplace-installed plugin, the marketplace version loads instead of the one at the specified path. The --plugin-dir flag should override (or at minimum merge with precedence over) marketplace-installed plugins.

Steps to Reproduce

  1. Have a plugin installed via marketplace (e.g. ~/.claude/plugins/marketplaces/<org>/<plugin-name>/, version 2.0.0)
  2. Have a local development copy of the same plugin at a different path (e.g. ~/dev/my-plugin/, version 1.0.0) that contains an agent definition not present in the marketplace version
  3. Run: claude --plugin-dir=~/dev/my-plugin "invoke the agent only in the local version"
  4. The marketplace version loads instead — the agent unique to the local version is unavailable

Expected Behavior

The plugin from --plugin-dir should take precedence over the marketplace-installed copy when they share the same plugin name. Agents and skills from --plugin-dir should be the ones loaded.

Actual Behavior

The marketplace version loads. Agent definitions only present in the --plugin-dir version are unavailable. The session resolves agent files from ~/.claude/plugins/marketplaces/... instead of the path passed via --plugin-dir.

Environment

  • Claude Code version: 2.1.195
  • OS: macOS (Darwin 25.5.0)
  • Shell: zsh

Impact

  • Plugin authors cannot test local changes without uninstalling the marketplace version first
  • Users cannot pin an older plugin version via --plugin-dir if the marketplace has a newer one
  • Makes iterative plugin development painful — the only workaround is rm -rf ~/.claude/plugins/marketplaces/<org>/<name>

View original on GitHub ↗

4 Comments

github-actions[bot] · 2 months ago

Found 3 possible duplicate issues:

  1. https://github.com/anthropics/claude-code/issues/40158
  2. https://github.com/anthropics/claude-code/issues/42363
  3. https://github.com/anthropics/claude-code/issues/19899

This issue will be automatically closed as a duplicate in 3 days.

  • If your issue is a duplicate, please close it and 👍 the existing issue instead
  • To prevent auto-closure, add a comment or 👎 this comment

🤖 Generated with Claude Code

poorakk · 2 months ago

Confirmed duplicate of #32619 — closing in favor of the canonical issue.

For anyone landing here: #32619 was closed as NOT_PLANNED, so until that changes the working guidance is to temporarily move the marketplace-installed copy out of the plugins dir before launching with --plugin-dir, then move it back when done:

mv ~/.claude/plugins/marketplaces/<org>/<plugin-name> /tmp/plugin-backup
# launch: claude --plugin-dir=/path/to/local/plugin ...
mv /tmp/plugin-backup ~/.claude/plugins/marketplaces/<org>/<plugin-name>
bcherny collaborator · 14 days ago

Thanks for the detailed report. I tried to reproduce this on 2.1.233 (Linux): installed a marketplace plugin demo v2.0.0, kept a local dev copy (v1.0.0 with an extra skill and agent) at another path, and ran claude --plugin-dir <path>. The local copy correctly took precedence — its extra skill/agent were available and the marketplace copy was not loaded. This is the documented behavior (see Plugins docs), and per the changelog it has worked this way since 2.1.74.

However, I could reproduce your exact symptom one way: --plugin-dir=~/dev/my-plugin with an unexpanded tilde. zsh (the macOS default) doesn't expand ~ after = in an option argument, so the CLI receives a literal ~/… path, the local plugin silently fails to load, and the marketplace copy wins — which matches what you saw. The failure only shows up in claude --plugin-dir <path> plugin list as "Path not found".

Could you check:

  1. claude --version
  2. The output of claude --plugin-dir <your-path> plugin list (does your local copy show as loaded?)
  3. Whether using a space instead of = (claude --plugin-dir ~/dev/my-plugin) or an absolute path fixes it?

If the plugin shows as loaded and the wrong version still wins, please share the debug log (--debug) and we'll dig further.

🤖 Generated with Claude Code

github-actions[bot] · 14 days ago

We weren't able to reproduce this. Could you provide steps to trigger the issue — what you ran, what happened, and what you expected? This issue will be closed automatically if there's no activity within 7 days.

Showing cached comments. Read the full discussion on GitHub ↗