Skip to content

[Bug]: Storage cleanup fails every run on a worktree folder that lost its .git (Windows) #37276

Closed as duplicate

Description

@jesseroldan-sb

Before submitting

  • I searched existing issues and did not find a duplicate.
  • I included enough detail to reproduce or investigate the problem.

Area

apps/server

Steps to reproduce

  1. On Windows, a thread's worktree contains a directory junction: a node_modules junction to the main checkout, or the one a Next.js dev build creates at .next\dev\node_modules\@sentry\server-runtime-injection-<hash>.
  2. Removing the worktree stops partway: .git and most files are gone, but the folder stays with the junction and a few files (package.json, README.md, ...).
  3. Let Storage Cleanup run.

Expected behavior

A folder in the managed worktrees directory whose .git is gone is treated as leftover: removed (unlinking junctions without following them), or listed as an orphan in Settings → Storage.

Actual behavior

Every run logs, for the thread that owned it:

storage cleanup failed for worktree
  reason: NotFound, FileSystem.stat
  path: C:\Users\<user>\Developer\.worktrees\<repo>\t3-<id>\.git
  ENOENT: no such file or directory

The folder is never removed or shown as removable, and the failure repeats every hour. I had 29 of these.

Impact

Minor bug or occasional failure

Version or commit

0.1.7

Environment

Windows 11, git for Windows, Next.js 16 project.

Workaround

Unlink each junction (Node's fs.unlinkSync removes the link, not its target), then delete the folder.

Related

#17813, #25843, #14990

  • Opus 5.5

Activity

  1. juliusmarminge commented on Nov 15, 2026

    @juliusmarminge
    Member

    This is the same problem as #24390, so I'm closing it in favour of that one. If it is different, say how and it will be reopened.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions