stablyai/orca · error · Error
Branch "${branchName}" already exists ${lastBranchConflictKi
Error message
Branch "${branchName}" already exists ${lastBranchConflictKind === 'local' ? 'locally' : 'on a remote'}. Pick a different ${branchConflictSubject}. What it means
Remote worktree create exhausted all candidate remote worktree paths (every path already exists) AND the last collision was caused by a pre-existing branch — locally or on a remote. lastBranchConflictKind records whether the conflicting branch was found locally or remotely; branchConflictSubject is 'branch name' when an override was given, else 'worktree name'. The message tells the user exactly which dimension to change.
Source
Thrown at src/main/ipc/worktree-remote.ts:1609
}
lastBranchConflictKind = null
}
remotePath = computeRemoteWorktreePath(
effectiveSanitizedName,
repo.path,
worktreePathSettings,
{
useConfiguredAbsolutePath: hasRepoWorktreeBasePath(repo)
}
)
if (!(await remotePathExists(fsProvider, remotePath))) {
remotePathResolved = true
break
}
}
if (!remotePathResolved) {
if (lastBranchConflictKind) {
throw new Error(
`Branch "${branchName}" already exists ${lastBranchConflictKind === 'local' ? 'locally' : 'on a remote'}. Pick a different ${branchConflictSubject}.`
)
}
throw new Error(
`Could not find an available remote worktree path for "${sanitizedName}". Pick a different worktree name.`
)
}
validateWorkspaceLineageParentBeforeCreate(
store,
args.parentWorkspace,
worktreeWorkspaceKey(`${repo.id}::${remotePath}`)
)
const sparseDirectories = args.sparseCheckout
? normalizeSparseDirectories(args.sparseCheckout.directories)
: []
if (args.sparseCheckout && sparseDirectories.length === 0) {View on GitHub (pinned to 1136503c6a)
Solutions
- Pick a different worktree name or branch name override so it doesn't collide with the existing local/remote branch.
- Delete or rename the conflicting branch (locally: git branch -D; remotely: git push origin --delete) if it is stale.
- If collisions are routine, widen the suffix range or change the naming template so the loop has more candidates.
Defensive patterns
Strategy: validation
Validate before calling
// Pre-check branch availability on local + remote before the create loop
const existsLocal = await localBranchExists(repo.path, candidateBranch)
const existsRemote = await remoteBranchExists(provider, repo.path, candidateBranch)
if (existsLocal || existsRemote) {
return { ok: false, fieldError: 'branchName', message: `Branch "${candidateBranch}" already exists (${existsLocal ? 'locally' : 'on a remote'}).` }
} Try / catch
catch (err) {
if (err instanceof Error && /already exists .*locally|on a remote/.test(err.message)) {
suggestAlternateNames(repo, sanitizedName)
} else { throw err }
} Prevention
- Choose unique worktree/branch names; avoid reusing names with existing local or remote branches.
- Clean up stale remote branches after merging PRs.
- Widen the suffix candidate range if your team reuses base names heavily.
When it happens
Trigger: Remote create loop tries suffixed remote paths; each remotePathExists check returns true; the loop exits with remotePathResolved still false and a prior branch conflict recorded. Reached at worktree-remote.ts:1609.
Common situations: Reusing a worktree name whose branch already exists on origin or locally; suffix exhaustion because many numbered worktrees already occupy the paths; overriding a branch name that collides with an existing local/remote branch.
Related errors
- Could not find an available remote worktree path for "${sani
- Could not resolve a default base ref for this repo. Pick a b
- SSH target "${input.target.connectionId}" is not connected.
- GitHub work items require a GitHub remote for SSH repositori
- Cannot download a directory
AI-assisted analysis of stablyai/orca@1136503c6a (2026-08-12).
Data as JSON: /api/errors/9b9b8cfa99d4c17c.
Report an issue: GitHub.