plugin uninstall: contradictory scope errors when the plugin is installed only in another folder
Summary
claude plugin uninstall <plugin> --scope <scope> gives two contradictory errors in a folder where the plugin was never installed, when the same plugin is installed at project or local scope in some other folder on the machine.
Steps to reproduce (Claude Code 2.1.299, macOS)
- Install a plugin at project scope in one checkout:
cd ~/repo-a && claude plugin install foo@bar --scope project. - In an unrelated folder with no settings:
mkdir /tmp/empty && cd /tmp/empty. claude plugin uninstall foo@bar --scope local
→ Failed to uninstall plugin "foo@bar": Plugin "foo@bar" is installed in project scope, not local. Use --scope project to uninstall.
claude plugin uninstall foo@bar --scope project
→ Failed to uninstall plugin "foo@bar": Plugin "foo@bar" is not installed in project scope. Use --scope to specify the correct scope.
- With no
--scope:... is installed in project scope, not user. Use --scope project to uninstall.
Expected
One message: the plugin is not installed for this folder (and, ideally, where it is installed: scope and project path, as claude plugin list shows).
What seems to happen
The "which scope is it installed in" check reads ~/.claude/plugins/installed_plugins.json without filtering entries by projectPath, so it reports the scope of an install in another folder; the removal step does filter by the current folder, finds nothing, and reports "not installed in project scope". The two messages together send the user back and forth.
Environment: Claude Code 2.1.299, macOS 26, zsh.