# Cursor removes active worktree directories and then closes/crashes unexpectedly

**URL:** <https://forum.cursor.com/t/cursor-removes-active-worktree-directories-and-then-closes-crashes-unexpectedly/160768>\
**Category:** Bug Reports\
**Tags:** crashes, worktrees\
**Created:** [May 15, 2026, 4:34pm UTC](https://forum.cursor.com/t/cursor-removes-active-worktree-directories-and-then-closes-crashes-unexpectedly/160768 "2026-05-15T16:34:31Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![Nate\_Perry-Thistle](https://sea3.discourse-cdn.com/cursor1/user_avatar/forum.cursor.com/nate_perry-thistle/32/108730_2.png) [@Nate\_Perry-Thistle](https://forum.cursor.com/u/Nate_Perry-Thistle)\
**Post date:** [May 15, 2026, 4:34pm UTC](https://forum.cursor.com/t/cursor-removes-active-worktree-directories-and-then-closes-crashes-unexpectedly/160768/1 "2026-05-15T16:34:31Z")

</div>

### Where does the bug appear (feature/product)?

Cursor IDE

### Describe the Bug

Cursor appears to be incorrectly cleaning up active git worktrees: directories that are still in use become missing, which causes repeated ENOENT / not a git repository errors in open workspaces, followed by intermittent Cursor self-closing/crash behavior.

### Steps to Reproduce

Open Cursor on macOS and open a repo that uses git worktrees (keep only 1-2 worktrees open).  
Work normally in those worktrees for a while (edit files, switch branches, run git actions in Cursor).  
Continue using Cursor until one open worktree path becomes invalid/missing.  
Observe errors in Cursor such as ENOENT for worktree paths and repeated fatal: not a git repository …/.git/worktrees/…  
Keep working after those errors appear; Cursor eventually closes/crashes on its own.

### Expected Behavior

Cursor should never delete or invalidate a git worktree that is currently open or actively in use.  
Open workspaces should continue to resolve to valid paths, with no ENOENT or not a git repository errors caused by internal cleanup.  
Background cleanup should only target truly stale, unused worktrees and should verify they are not active first.  
Cursor should remain stable and not close/crash as a side effect of worktree management.

### Operating System

MacOS

### Version Information

Version: 3.4.20 (Universal)  
VSCode Version: 1.105.1  
Commit: 0cf8b06883f54e26bb4f0fb8647c9500ccb43310  
Date: 2026-05-15T02:26:10.351Z  
Layout: glass  
Build Type: Stable  
Release Track: Default  
Electron: 39.8.1  
Chromium: 142.0.7444.265  
Node.js: 22.22.1  
V8: 14.2.231.22-electron.0  
OS: Darwin arm64 25.4.0

### Additional Information

Cursor logs show active worktree paths later failing validation with ENOENT (directory no longer exists).  
The same session shows WorktreeCleanupCron registered and running on a 6-hour interval.  
Git extension logs repeatedly report fatal: not a git repository for paths under .git/worktrees/…, consistent with worktrees being removed/invalidated while still referenced.  
Main process logs show repeated MCP process crash/restart failures and eventual fallback after exceeding restart budget, indicating broader instability around the same timeframe.  
macOS DiagnosticReports (.diag) from affected periods include file-removal call stacks (removeItem, removefile, unlink) inside Cursor-related processes, supporting the unexpected deletion symptom.

### Does this stop you from using Cursor

Yes - Cursor is unusable

---

<div class="post-metadata">

**Author:** ![kevinn](https://sea3.discourse-cdn.com/cursor1/user_avatar/forum.cursor.com/kevinn/32/101206_2.png) [@kevinn](https://forum.cursor.com/u/kevinn)\
**Post date:** [May 15, 2026, 5:45pm UTC](https://forum.cursor.com/t/cursor-removes-active-worktree-directories-and-then-closes-crashes-unexpectedly/160768/9 "2026-05-15T17:45:45Z")

</div>

Hi @Nate_Perry-Thistle Thanks very much for reporting, and I apologize for the inconvenience. we’ve replicated this internal and we have a bug report open to fix. I’ll let you know when it’s sorted out! Thanks for letting us know.

---

<div class="post-metadata">

**Author:** ![kevinn](https://sea3.discourse-cdn.com/cursor1/user_avatar/forum.cursor.com/kevinn/32/101206_2.png) [@kevinn](https://forum.cursor.com/u/kevinn)\
**Post date:** [May 15, 2026, 5:58pm UTC](https://forum.cursor.com/t/cursor-removes-active-worktree-directories-and-then-closes-crashes-unexpectedly/160768/10 "2026-05-15T17:58:51Z")

</div>

Hi @Nate_Perry-Thistle

In the meantime, here are some settings you can tweak that might help. You can also drop this into cursor and ask the agent to make these changes for you:

Add this to your **Cursor Settings → Open Settings (JSON)**:

```json
{

"cursor.worktreesGlobalMaxSizeGb": 0,

"cursor.worktreeMaxCount": 100,

"cursor.worktreeCleanupIntervalHours": 168

}

```

Not 100% this will solve it but I think this will help.

- `worktreesGlobalMaxSizeGb: 0` disables size-based cleanup entirely.

- A higher `worktreeMaxCount` reduces count-based eviction pressure.

---

<div class="post-metadata">

**Author:** ![Trevor\_Rydalch](https://avatars.discourse-cdn.com/v4/letter/t/779978/32.png) [@Trevor\_Rydalch](https://forum.cursor.com/u/Trevor_Rydalch)\
**Post date:** [July 23, 2026, 3:58am UTC](https://forum.cursor.com/t/cursor-removes-active-worktree-directories-and-then-closes-crashes-unexpectedly/160768/12 "2026-07-23T03:58:47Z")

</div>

This is an incredibly frustrating bug. I’ve just used probably 10-15% of my monthly Ultra usage in two separate worktrees that keep getting deleted after hours of work. I’ve done deep grilling sessions, large scale refactors. Fortunately I pushed much of it to a remote branch, but still.
