---
name: worktree-remove-partial-failure-reads-total
description: "git worktree remove \"Permission denied\" can mean everything already deleted except the pinned directory ENTRY — verify what remains before retrying the whole removal"
metadata: 
  node_type: memory
  type: feedback
  originSessionId: 21352d21-bf56-4eef-a2de-9d104632d3f8
  modified: 2026-08-19T20:46:03.606Z
---

`git worktree remove` reported `Permission denied` during a teardown; the natural read is "removal failed, retry it." Measured (deployah testimony, 2026-08-19 v0.57.0 teardown): the CONTENT had all deleted — only the directory entry itself was handle-pinned. The fix was `rmdir` + `git worktree prune`, not a retry of the removal.

**Why:** a partial failure that reads as a total one sends you back through a destructive verb whose work is already done — and a blind retry can mask what is actually pinning the entry.

**How to apply:** on any worktree-remove error, `Get-ChildItem` the target FIRST. Empty-but-present ⇒ rmdir + prune (and if still pinned, find the handle — see [[orphan-conhost-cwd-pins-worktree]]). Non-empty ⇒ then it is a real removal failure.
