[BUG] --plugin-dir does not take precedence over marketplace-installed plugin with same name
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
- Have a plugin installed via marketplace (e.g.
~/.claude/plugins/marketplaces/<org>/<plugin-name>/, version 2.0.0) - 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 - Run:
claude --plugin-dir=~/dev/my-plugin "invoke the agent only in the local version" - 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-dirif the marketplace has a newer one - Makes iterative plugin development painful — the only workaround is
rm -rf ~/.claude/plugins/marketplaces/<org>/<name>
Showing cached comments. Read the full discussion on GitHub ↗
4 Comments
Found 3 possible duplicate issues:
This issue will be automatically closed as a duplicate in 3 days.
🤖 Generated with Claude Code
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:Thanks for the detailed report. I tried to reproduce this on 2.1.233 (Linux): installed a marketplace plugin
demov2.0.0, kept a local dev copy (v1.0.0 with an extra skill and agent) at another path, and ranclaude --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-pluginwith 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 inclaude --plugin-dir <path> plugin listas "Path not found".Could you check:
claude --versionclaude --plugin-dir <your-path> plugin list(does your local copy show as loaded?)=(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
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.