stablyai/orca · error · Error
Refusing to delete unregistered worktree path: ${worktreePat
Error message
Refusing to delete unregistered worktree path: ${worktreePath} What it means
Final fallthrough throw in the unregistered-worktree branch of worktrees:remove: the path is not a Git-registered worktree, is not provably an Orca orphan (cleanup checks failed), and is not already removed. Orca refuses to delete an unregistered path it cannot prove is a worktree, rather than risk deleting an arbitrary directory.
Source
Thrown at src/main/ipc/worktrees.ts:2629
args.worktreeId,
removedPushTarget,
store,
localWorktreeGitOptions
)
invalidateAuthorizedRootsCache()
}
runtime.clearOptimisticReconcileToken(args.worktreeId)
removeWorktreeMetadataAndTransientState(store, args.worktreeId, removalHostId)
preservedBranchCleanupByScope.delete(
preservedBranchCleanupScopeKey({
worktreeId: args.worktreeId,
hostId: removalHostId
})
)
notifyWorktreesChanged(mainWindow, repoId)
return {}
}
throw new Error(`Refusing to delete unregistered worktree path: ${worktreePath}`)
}
const canonicalWorktreePath = registeredWorktree.path
const deleteBranch = removedMeta?.preserveBranchOnDelete !== true
// Why: a Git lock must block before archive hooks or linked-path cleanup mutate the workspace; dirty-file force is separate.
try {
assertWorktreeUnlockedForRemoval(registeredWorktree)
} catch (error) {
throw new Error(
formatWorktreeRemovalError(error, canonicalWorktreePath, args.force ?? false)
)
}
// Why: a prior forced Windows recovery can delete the dir but leave a stale Git registration; verify before clearing metadata.
if (
!repo.connectionId &&
args.force === true &&
process.platform === 'win32' &&View on GitHub (pinned to 1136503c6a)
Solutions
- Verify the path is actually a worktree of this repo (`git worktree list`); if not, no Orca removal applies.
- If the registration is merely stale, run `git worktree prune` on the host and retry.
- For genuinely orphaned Orca directories that fail the safety check, remove them manually rather than forcing Orca to delete an unproven path.
Defensive patterns
Strategy: try-catch
Validate before calling
// Confirm the path is a registered worktree before attempting removal.
const worktrees = await invoke('worktrees:list', { repoId })
const exists = worktrees.some((w) => w.id === worktreeId)
if (!exists) {
// Possibly stale; run prune or drop the row instead of forcing delete.
return
} Try / catch
try {
await invoke('worktrees:remove', { worktreeId })
} catch (e) {
if (e.message.startsWith('Refusing to delete unregistered worktree path')) {
// Inspect `git worktree list`; prune or remove manually — do not force blindly.
} else throw e
} Prevention
- Run `git worktree prune` to resolve stale registrations before removing.
- Never force-delete a path Orca cannot classify as a worktree.
- Remove genuinely orphaned directories manually on the host.
When it happens
Trigger: A worktrees:remove where the target path is unregistered by Git, fails the safe-orphan and leftover-directory checks, and isn't detected as already removed — i.e. an unregistered path Orca cannot safely classify.
Common situations: The worktreeId points at a path that was moved/renamed, is a non-worktree directory, or whose Git registration and Orca metadata are both inconsistent; or the path sits outside the repo and fails isDangerousWorktreeRemovalPath.
Related errors
- SSH filesystem provider unavailable
- SSH filesystem provider lstat unavailable
- Worktree is no longer registered with Git but its directory
- Worktree is no longer registered with Git and its directory
- Failed to delete worktree at ${canonicalWorktreePath}.
AI-assisted analysis of stablyai/orca@1136503c6a (2026-08-12).
Data as JSON: /api/errors/2bb124a897ffbb4d.
Report an issue: GitHub.