[BUG] extraKnownMarketplaces directory source resolves against main repo root instead of worktree root
Preflight Checklist
- [x] I have searched existing issues and this hasn't been reported yet
- [x] This is a single bug report (please file separate reports for different bugs)
- [x] I am using the latest version of Claude Code
What's Wrong?
When running Claude Code from a manually created git worktree, the extraKnownMarketplaces setting with a relative "path" resolves against the main repository root instead of the current worktree root. This causes local plugin marketplaces to fail to load.
The path resolves from the main repo root: Marketplace file not found at /path/to/main-repo/.claude-plugins/.claude-plugin/marketplace.json
What Should Happen?
The relative path .claude-plugins resolves from the worktree root, loading the marketplace at <worktree>/.claude-plugins/.claude-plugin/marketplace.json.
Error Messages/Logs
❯ test-local (project)
Marketplace file not found at /private/tmp/worktree-plugin-bug/main-repo/.claude-plugins/.claude-plugin/marketplace.json
✘ hello-plugin @ test-local (project)
Plugin "hello-plugin" not found in marketplace "test-local"
Plugin may not exist in marketplace "test-local"
Steps to Reproduce
- Create a test repo and a worktree:
mkdir /tmp/worktree-plugin-bug && cd /tmp/worktree-plugin-bug
git init main-repo && cd main-repo
git commit --allow-empty -m "init"
git worktree add ../worktree -b test-branch
cd ../worktree
- Create a local marketplace with one plugin
mkdir -p .claude-plugins/.claude-plugin
mkdir -p .claude-plugins/hello-plugin/.claude-plugin
cat > .claude-plugins/.claude-plugin/marketplace.json << 'EOF'
{
"name": "test-local",
"owner": { "name": "Test", "email": "test@example.com" },
"metadata": { "description": "Test local marketplace" },
"plugins": [
{ "name": "hello-plugin", "source": "./hello-plugin" }
]
}
EOF
cat > .claude-plugins/hello-plugin/.claude-plugin/plugin.json << 'EOF'
{
"name": "hello-plugin",
"version": "1.0.0",
"description": "Test plugin"
}
EOF
- Configure Claude to use it
mkdir -p .claude
cat > .claude/settings.json << 'EOF'
{
"extraKnownMarketplaces": {
"test-local": {
"source": {
"source": "directory",
"path": ".claude-plugins"
}
}
},
"enabledPlugins": {
"hello-plugin@test-local": true
}
}
EOF
- Launch claude from the worktree
claude /plugin and tab across to errors
Symlinking the marketplace into main-repo makes the plugin load successfully.
Claude Model
Opus
Is this a regression?
I don't know
Last Working Version
_No response_
Claude Code Version
2.1.112 (Claude Code)
Platform
Anthropic API
Operating System
macOS
Terminal/Shell
VS Code integrated terminal
Additional Information
_No response_
This issue has 3 comments on GitHub. Read the full discussion on GitHub ↗