EveryInc/compound-engineering-plugin · error · Error

Failed to clone branch '${branch}' from ${source}. ${stderr.

Error message

Failed to clone branch '${branch}' from ${source}. ${stderr.trim()}

What it means

`plugin-path --branch <name>` clones the source repository at that branch via `git clone --branch`. When git exits non-zero during the clone, the command wraps git's stderr into this error. The most common cause is the branch not existing on the remote, but any clone failure (network, auth, bad URL) lands here.

Source

Thrown at src/commands/plugin-path.ts:90

      const manifest = JSON.parse(raw) as { name?: string }
      if (manifest.name === pluginName) return repoDir
    } catch {
      // Fall through to the legacy multi-plugin layout.
    }
  }

  return path.join(repoDir, "plugins", pluginName)
}

async function cloneBranch(source: string, destination: string, branch: string): Promise<void> {
  const proc = Bun.spawn(["git", "clone", "--depth", "1", "--branch", branch, source, destination], {
    stdout: "pipe",
    stderr: "pipe",
  })
  const exitCode = await proc.exited
  const stderr = await new Response(proc.stderr).text()
  if (exitCode !== 0) {
    throw new Error(`Failed to clone branch '${branch}' from ${source}. ${stderr.trim()}`)
  }
}

async function fetchAndCheckout(repoDir: string, branch: string): Promise<void> {
  const fetch = Bun.spawn(["git", "fetch", "origin", branch], {
    cwd: repoDir,
    stdout: "pipe",
    stderr: "pipe",
  })
  const fetchExit = await fetch.exited
  const fetchErr = await new Response(fetch.stderr).text()
  if (fetchExit !== 0) {
    throw new Error(`Failed to fetch branch '${branch}'. ${fetchErr.trim()}`)
  }

  const reset = Bun.spawn(["git", "reset", "--hard", `origin/${branch}`], {
    cwd: repoDir,
    stdout: "pipe",

View on GitHub (pinned to c9c10f8c75)

Solutions

  1. Read the git stderr in the message; if it says the branch was not found, list branches: `git ls-remote --heads <source>`.
  2. Fix the --branch spelling or use the default (no --branch) clone.
  3. Check network/proxy and git credentials for the remote.
  4. Verify COMPOUND_PLUGIN_GITHUB_SOURCE (if set) points at the correct repo.

Example fix

// before
plugin-path compound-engineering --branch feat/new-agents  # deleted branch
// after
plugin-path compound-engineering  # default branch
Defensive patterns

Strategy: validation

Validate before calling

// Check the branch exists on the remote before plugin-path --branch
const out = Bun.spawnSync(["git", "ls-remote", "--heads", source, branch])
if (out.exitCode !== 0 || !out.stdout.toString().trim()) throw new Error(`Branch ${branch} not found on ${source}`)

Try / catch

try {
  const p = await pluginPath(plugin, { branch })
} catch (e) {
  if (e instanceof Error && e.message.startsWith("Failed to clone branch")) {
    console.error(`Clone failed for branch ${branch}: ${e.message}`)
    // fall back to default branch
    return pluginPath(plugin)
  } else throw e
}

Prevention

When it happens

Trigger: Running `plugin-path <plugin> --branch <branch>` when: the branch does not exist on the remote (`Remote branch <branch> not found`), the remote is unreachable, credentials are missing for a private repo, or COMPOUND_PLUGIN_GITHUB_SOURCE is an invalid URL.

Common situations: Branch typo; branch was deleted/rebased away on the remote; testing a feature branch that was force-pushed under a new name; offline; private fork needing auth.

Related errors


AI-assisted analysis of EveryInc/compound-engineering-plugin@c9c10f8c75 (2026-08-31). Data as JSON: /api/errors/d7ace95d0d1fd50e. Report an issue: GitHub.