stablyai/orca · error · Error
Failed to force delete worktree at ${canonicalWorktreePath}.
Error message
Failed to force delete worktree at ${canonicalWorktreePath}. What it means
Thrown in the local removeWorktree catch block when the Git removal error is not recoverable by the Windows recovery path and not an orphan-classified error. formatWorktreeRemovalError with force=true yields the 'Failed to force delete...' prefix plus the underlying Git stderr/stdout. This is the terminal failure after all recovery options are exhausted.
Source
Thrown at src/main/ipc/worktrees.ts:2936
args.worktreeId,
removedPushTarget,
store,
localWorktreeGitOptions
)
runtime.clearOptimisticReconcileToken(args.worktreeId)
removeWorktreeMetadataAndTransientState(store, args.worktreeId, removalHostId)
preservedBranchCleanupByScope.delete(
preservedBranchCleanupScopeKey({
worktreeId: args.worktreeId,
hostId: removalHostId
})
)
invalidateAuthorizedRootsCache()
notifyWorktreesChanged(mainWindow, repoId)
removalCompleted = true
return {}
} else {
throw new Error(
formatWorktreeRemovalError(error, canonicalWorktreePath, args.force ?? false)
)
}
}
removalCompleted = true
} finally {
await removalGate.finish(removalCompleted)
}
await cleanupUnusedWorktreePushTargetRemote(
repo.path,
args.worktreeId,
removedPushTarget,
store,
localWorktreeGitOptions
)
rememberPreservedBranchCleanupTarget(
args.worktreeId,
removalHostId,View on GitHub (pinned to 1136503c6a)
Solutions
- Close all programs holding files in the worktree (editors, terminals, watchers) and retry.
- On Windows/WSL, check for path-too-long or locked handles; retry after releasing them.
- Inspect the appended Git stderr in the message for the root cause and address it (permissions, disk, antivirus).
Defensive patterns
Strategy: try-catch
Type guard
function isForceDeleteFailure(e: unknown): boolean {
return e instanceof Error && e.message.startsWith('Failed to force delete worktree')
} Try / catch
try {
await invoke('worktrees:remove', { worktreeId, force: true })
} catch (e) {
if (isForceDeleteFailure(e)) {
// Close programs holding handles, free locks, then surface the appended Git error to the user.
} else throw e
} Prevention
- Close editors, terminals, and watchers that hold handles in the worktree before forcing.
- On Windows/WSL, watch for path-too-long and locked-handle errors.
- Read the appended Git stderr to find the underlying cause (permissions, AV, disk).
When it happens
Trigger: A forced worktrees:remove where `git worktree remove` fails for a reason other than orphan status or a Windows-transient deregistration — e.g. permission error, path-too-long, busy file handle, or filesystem I/O error.
Common situations: Windows file handles (editors, terminals, AV) lock files during recursive delete; WSL/Windows path-length limits; permission/ownership issues on the worktree directory; SSH-backed host I/O errors.
Related errors
- Packaged node-pty is missing ${conptyRoot}
- Packaged node-pty is missing ${sourceFile}
- Windows inner executable does not exist: ${executablePath}
- Windows inner executable path is not a file: ${executablePat
- Could not create a temporary WSL Claude login directory.
AI-assisted analysis of stablyai/orca@1136503c6a (2026-08-12).
Data as JSON: /api/errors/7048297c4dd80586.
Report an issue: GitHub.