πŸ› Bug Report: Path Resolution Inconsistency in Git Worktree Mode

Where does the bug appear (feature/product)?

Cursor IDE

Describe the Bug

Description
File edit tools (search_replace, write) have inconsistent path resolution when the workspace root is a deeply nested path in a git worktree. Paths that contain segments matching the workspace structure are incorrectly resolved from the worktree root instead of the workspace root.

Steps to Reproduce

Steps to Reproduce
Set up a git worktree with Cursor
Set workspace root to a deeply nested path (e.g., C:\Projects\myapp\src\main\frontend)
Attempt to edit a file using a path that contains workspace structure segments:
myapp/src/main/frontend/src/components/MyComponent.tsx
Observe that the file is written to the wrong location (worktree root):
C:\Users\username.cursor\worktrees\myrepo\branch-name\myapp\src\main\frontend\src\components\MyComponent.tsx
Instead of the intended location (workspace root):
C:\Projects\myapp\src\main\frontend\src\components\MyComponent.tsx

Expected Behavior

All relative paths should resolve from the configured workspace root, regardless of whether the path segments match the directory structure above it.
Actual Behavior
Paths containing segments that match the workspace path structure are incorrectly resolved from the worktree root, creating duplicate nested directories with the changes applied to the wrong files.

Operating System

Windows 10/11

Current Cursor Version (Menu β†’ About Cursor β†’ Copy)

Version: 2.3.35 (user setup)
VSCode Version: 1.105.1
Commit: cf8353edc265f5e46b798bfb276861d0bf3bf120
Date: 2026-01-13T07:39:18.564Z
Electron: 37.7.0
Chromium: 138.0.7204.251
Node.js: 22.20.0
V8: 13.8.258.32-electron.0
OS: Windows_NT x64 10.0.26100

For AI issues: which model did you use?

Sonnet 4.5

Does this stop you from using Cursor

No - Cursor works, but with this issue

Hey, thanks for the detailed report.

This looks like a bug in the path resolution logic for worktrees. The team is already working on similar path issues in worktree mode.

Can you share the Request ID for the case where the file was saved to the wrong place? That’ll help the team track down the exact scenario. You can get it from the chat menu in the top right, then Copy Request ID.

As a workaround for now, you can try opening the workspace at the repo level, not from a deeply nested path.

Thanks,

Request ID : e4d25486-8f95-43bf-877c-060b1037bb01