CLAUDE_CODE_PLUGIN_KEEP_MARKETPLACE_ON_FAILURE breaks fresh marketplace installation

Resolved 💬 2 comments Opened Apr 5, 2026 by lbzepoqo Closed May 16, 2026

Summary

Setting CLAUDE_CODE_PLUGIN_KEEP_MARKETPLACE_ON_FAILURE=1 in settings.json causes all new marketplace installations to fail with "Marketplace file not found", because it prevents the initial clone from ever running.

Steps to Reproduce

  1. Add "CLAUDE_CODE_PLUGIN_KEEP_MARKETPLACE_ON_FAILURE": "1" to the env block in ~/.claude/settings.json
  2. Run /install and enter any new marketplace (e.g. JuliusBrussee/caveman)
  3. Observe immediate error: Marketplace file not found at ~/.claude/plugins/marketplaces/JuliusBrussee-caveman/.claude-plugin/marketplace.json

No clone progress is shown. The directory is never created.

Root Cause

Traced from the 2.1.92 binary. The Ws function serves double duty as both a fresh clone path and a refresh/update path for existing marketplaces. On a fresh install:

  1. Dt9 (sparse-checkout reconcile) returns {code: 0} when the directory doesn't exist. When no sparsePaths are configured, it runs git config --get core.sparseCheckout in the target directory. This git command fails (non-zero exit) because the directory doesn't exist — but Dt9 only returns {code: 1} when the command succeeds and reports true. A git failure falls through to return {code: 0, stderr: ""} — falsely signaling "no sparse checkout issues."
  1. Yt9 (git pull) is then attempted on the non-existent directory and fails immediately.
  1. KEEP_MARKETPLACE_ON_FAILURE causes early return without cloning:

``js
if (dH(process.env.CLAUDE_CODE_PLUGIN_KEEP_MARKETPLACE_ON_FAILURE)) {
N(
git pull failed, keeping existing clone...);
return; // ← exits without ever cloning
}
``
The function can't distinguish "pull failed on an existing clone" from "directory doesn't exist yet."

  1. Back in D66, no error was thrown, so it tries to read .claude-plugin/marketplace.json from the never-created directory → "Marketplace file not found".

Expected Behavior

CLAUDE_CODE_PLUGIN_KEEP_MARKETPLACE_ON_FAILURE should only apply when a marketplace directory already exists. For fresh installs (directory absent), the clone should always proceed regardless of this env var.

Suggested Fix

In Ws, before applying the KEEP_MARKETPLACE_ON_FAILURE guard, check whether the target directory actually exists:

if (dH(process.env.CLAUDE_CODE_PLUGIN_KEEP_MARKETPLACE_ON_FAILURE) && directoryExists($)) {
  // keep existing clone
  return;
}
// fall through to re-clone

Alternatively, Dt9 could return {code: 1} when the target directory doesn't exist at all, which would bypass the git pull path entirely and go straight to clone.

Environment

  • Version: 2.1.92
  • Platform: Linux (WSL2)
  • Workaround: Remove CLAUDE_CODE_PLUGIN_KEEP_MARKETPLACE_ON_FAILURE from settings.json env block

View original on GitHub ↗

This issue has 2 comments on GitHub. Read the full discussion on GitHub ↗