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
- Read the git stderr in the message; if it says the branch was not found, list branches: `git ls-remote --heads <source>`.
- Fix the --branch spelling or use the default (no --branch) clone.
- Check network/proxy and git credentials for the remote.
- 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
- Verify the branch name with `git ls-remote --heads <source>` before using --branch.
- Don't reference feature branches that may be deleted after merge; use main for stable installs.
- Keep git credentials and network access working for the remote.
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
- Failed to clone ${source}. ${stderr.trim()}
- Failed to fetch branch '${branch}'. ${fetchErr.trim()}
- Failed to reset to origin/${branch}. ${resetErr.trim()}
- ${command} ${args.join(" ")} failed: ${detail}
AI-assisted analysis of EveryInc/compound-engineering-plugin@c9c10f8c75 (2026-08-31).
Data as JSON: /api/errors/d7ace95d0d1fd50e.
Report an issue: GitHub.