stablyai/orca · warning · Error
Worktree is no longer registered with Git but its directory
Error message
Worktree is no longer registered with Git but its directory remains.
What it means
Thrown (ORPHANED_WORKTREE_DIRECTORY_MESSAGE) on the SSH/orphan-safe branch when the worktree is no longer Git-registered, its directory still exists and is proven safe to remove, but args.force is not set. Orca will not auto-delete a proven orphan without explicit force; the error is a prompt for the user to confirm force-delete.
Source
Thrown at src/main/ipc/worktrees.ts:2485
(path) => fsProvider.lstat!(path),
(path) => fsProvider.readFile(path)
)
} else {
const access = getLocalWorktreePathAccess(localWorktreeGitOptions)
canCleanOrphanedDirectory =
!isDangerousWorktreeRemovalPath(worktreePath, repo.path) &&
(await canSafelyRemoveOrphanedWorktreeDirectory(
toLocalWorktreeRuntimePath(worktreePath, localWorktreeGitOptions),
toLocalWorktreeRuntimePath(repo.path, localWorktreeGitOptions),
access.statPath,
access.readPath
))
}
}
if (canCleanOrphanedDirectory) {
assertWorktreeDoesNotContainRegisteredWorktree(worktreePath, registeredWorktrees)
if (!args.force) {
throw new Error(ORPHANED_WORKTREE_DIRECTORY_MESSAGE)
}
if (repo.connectionId) {
const removalGate = await runtime.acquireFileWatcherRemoval(
worktreePath,
repo.connectionId
)
let removalCompleted = false
try {
await stopPtysForDestructiveWorktreeRemoval(runtime, args.worktreeId, {
connectionId: repo.connectionId,
allowUnverifiedStop: args.allowUnverifiedPtyStop
})
await fsProvider!.deletePath(worktreePath, true)
removalCompleted = true
} finally {
await removalGate.finish(removalCompleted)
}
await cleanupUnusedWorktreePushTargetRemoteSsh(View on GitHub (pinned to 1136503c6a)
Solutions
- Retry the removal with args.force set to true to clean the orphaned directory.
- Confirm the directory is the intended worktree before forcing (the safety check already validates it isn't the repo root or dangerous).
- If you do not want Orca to delete it, remove the directory manually and the next remove will take the already-gone path.
Example fix
// before
invoke('worktrees:remove', { worktreeId, force: false })
// after
invoke('worktrees:remove', { worktreeId, force: true }) Defensive patterns
Strategy: retry
Type guard
function isOrphanedDirectoryMessage(e: unknown): boolean {
return e instanceof Error && e.message.startsWith('Worktree is no longer registered with Git but its directory remains')
} Try / catch
try {
await invoke('worktrees:remove', { worktreeId, force: false })
} catch (e) {
if (isOrphanedDirectoryMessage(e)) {
// Prompt user, then confirm with force.
await invoke('worktrees:remove', { worktreeId, force: true })
} else throw e
} Prevention
- Prompt the user to confirm force-delete when an orphaned directory is detected.
- Avoid leaving directories behind after out-of-band `git worktree remove`.
- Use force only after the safety check has validated the path.
When it happens
Trigger: A worktrees:remove (no force) where Git has deregistered the worktree but the directory remains on disk (or on the SSH host) and passes the safe-orphan checks.
Common situations: An external tool or a prior failed delete deregistered the worktree in Git while leaving the files behind; the directory is now an Orca-tracked orphan.
Related errors
- Worktree is no longer registered with Git and its directory
- No preserved branch cleanup is pending for "${branchName}".
- Repo not found: ${repoId}
- Worktree deletion already in progress: ${args.worktreeId}
- Cannot delete the project root workspace. Remove the folder
AI-assisted analysis of stablyai/orca@1136503c6a (2026-08-12).
Data as JSON: /api/errors/73b795cc654f1b01.
Report an issue: GitHub.