[BUG] Update marketplace" in plugin manager fails with 3 different, contradictory errors for a valid git-based marketplace
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?
Environment:
- macOS 26.3.1 (build 25D771280a)
- git 2.50.1 (Apple Git-155)
- Marketplace source: git,
https://github.com/healthgrades/hg-claude-plugins.git - Claude Code version: (check Help/About in the app — not retrievable from this session)
Steps to reproduce:
- Have a git-based marketplace already added and successfully cloned (
hg-claude-plugins, registered in~/.claude/plugins/known_marketplaces.json). - Open the Manage Plugins panel → Marketplaces tab.
- Click the refresh icon next to the marketplace to pick up new upstream commits.
Expected: the tool does a git fetch/pull (or equivalent) against the existing local clone and updates it to the latest commit.
Actual: three different failures across repeated attempts, none of which reflect the real state of the repo:
- First attempt:
````
✘ Failed to update marketplace(s): Failed to refresh marketplace 'hg-claude-plugins': Failed to clone marketplace repository: Cloning into '/Users/.../hg-claude-plugins'... BUG: refs/files-backend.c:3050: initial ref transaction called with existing refs
- After a machine restart, retrying the same button:
````
✘ ... fatal: destination path '/Users/.../hg-claude-plugins' already exists and is not an empty directory.
- After deleting the local clone directory so a clean clone could occur:
````
✘ ... The marketplace.json file is no longer present in this repository. This marketplace may have been deprecated or moved to a new location. ... You can remove this marketplace with: claude plugin marketplace remove hg-claude-plugins
Evidence the repo/file are fine (this is a tool bug, not a repo problem):
- After the "failed" clone,
~/.claude/plugins/marketplaces/hg-claude-plugins/is a valid, clean git checkout:git status→ "up to date with origin/main",git log -1matchesgit ls-remote origin mainexactly (commitcc52e5098b87...). ~/.claude/plugins/marketplaces/hg-claude-plugins/.claude-plugin/marketplace.jsonexists (14,362 bytes) at the exact path the tool claims is missing.
Impact: Because "Update marketplace" never reports success, ~/.claude/plugins/installed_plugins.json stays pinned to a stale commit (f851622da622 from 2026-06-24) for all plugins from this marketplace (release-ucms-ssp, team-config, announce, jira, qa-steps), even though the marketplace's own git clone already has the newer commit (cc52e5098b87, 2026-07-08) on disk. No supported UI path currently gets installed plugins re-pinned to the newer commit.
Suggested root cause: the refresh flow appears to always attempt a fresh git clone into the marketplace's install directory rather than fetching/pulling an existing clone, and its precondition/error-detection logic (marketplace.json existence check) appears to run against stale or wrong state, producing false-negative errors.
What Should Happen?
The refresh should have done a git fetch + git pull (or fetch + reset to the remote ref) against the existing clone at ~/.claude/plugins/marketplaces/hg-claude-plugins/, since that clone was already there and valid — not attempted a fresh git clone into a directory that already has content. That's the root cause of all three errors: every retry path assumes "no clone exists yet" and tries to create one, so it trips over its own leftover state.
Concretely, the correct flow would have been:
- Detect the marketplace directory already has a git repo.
git fetch origin+git reset --hard origin/main(or equivalent) to bring it to the latest commit — no clone-from-scratch needed.- Re-read
.claude-plugin/marketplace.jsonfrom that updated checkout (which was there the whole time) to get the new plugin listing. - Re-pin
installed_plugins.jsonentries forrelease-ucms-ssp,team-config, etc. to the new commit SHA, and refresh the plugin cache under~/.claude/plugins/cache/hg-claude-plugins/.../<new-sha>/.
Instead, the tool tried to clone every time, which is why deleting the directory didn't even help — a fresh clone should have succeeded into an empty directory, but instead threw a third, unrelated "marketplace.json missing" error, suggesting the update logic doesn't even wait for its own clone to finish (or checks the wrong path/ref) before validating.
Error Messages/Logs
Steps to Reproduce
Here's a detailed, standalone steps-to-reproduce section:
Steps to reproduce:
- Add a git-based marketplace (source:
https://github.com/healthgrades/hg-claude-plugins.git) and install at least one plugin from it (e.g.release-ucms-ssp@hg-claude-plugins). This creates:
~/.claude/plugins/marketplaces/hg-claude-plugins/— a full git clone of the marketplace repo~/.claude/plugins/known_marketplaces.json— marketplace registration~/.claude/plugins/installed_plugins.json— pins each installed plugin to the commit SHA it was cloned at (e.g.f851622da622, dated 2026-06-24)
- Let time pass while the upstream repo receives new commits (in this case, a commit
cc52e5098b87landed 2026-07-08 fixing bugs in the very skill installed). - Open the Manage Plugins panel → Marketplaces tab.
- Click the refresh icon next to
hg-claude-pluginsto pull the new commits.
- Result A: fails with
BUG: refs/files-backend.c:3050: initial ref transaction called with existing refs(attempting a fresh clone into the already-populated directory).
- Restart the machine. Repeat step 4 without changing anything else.
- Result B: fails with
fatal: destination path '.../hg-claude-plugins' already exists and is not an empty directory.(confirms it's retrying the same clone-into-existing-dir operation, not a fetch/pull).
- Manually delete the stale local clone (
rm -rf ~/.claude/plugins/marketplaces/hg-claude-plugins) so the next attempt has a truly empty target directory. Repeat step 4.
- Result C: fails with
The marketplace.json file is no longer present in this repository. ... You can remove this marketplace with: claude plugin marketplace remove hg-claude-plugins— despite the directory being freshly re-cloned, onorigin/main, matching the remote's latest commit exactly, and.claude-plugin/marketplace.jsonexisting on disk at the expected path (verified viagit log,git status,git ls-remote, andfind/lson the file).
- At no point does
installed_plugins.jsonget updated — plugins from this marketplace remain pinned to the original 2026-06-24 commit, even though the local marketplace clone itself is up to date at every stage after step 6.
Note: step 6 is a destructive workaround attempted only after step 5 failed identically post-restart — it did not fix the underlying issue and produced a third, distinct false error instead.
Claude Model
None
Is this a regression?
I don't know
Last Working Version
_No response_
Claude Code Version
Claude 1.19367.0 (1a5be1) 2026-07-07T05:45:41.000Z
Platform
Anthropic API
Operating System
macOS
Terminal/Shell
Terminal.app (macOS)
Additional Information
_No response_