Error on running agent in a worktree in a remote branch

Where does the bug appear (feature/product)?

Cursor IDE

Describe the Bug

The agent hangs forever when I start a chat in a worktree from a remote branch (that’s not available locally). I can fix it manually running git fetch origin <branch-name>:<branch-name>.

Steps to Reproduce

  1. Create a remote branch remote-branch
  2. Start a new chat that will run in a worktree and select remote-branch as a base.
  3. Ask anything, and Cursor will pop an error Failed to create Git worktree: Failed to execute git

Screenshots / Screen Recordings

Operating System

MacOS

Version Information

Version: 2.6.13 (Universal)
VSCode Version: 1.105.1
Commit: 60faf7b51077ed1df1db718157bbfed740d2e160
Date: 2026-03-06T06:17:49.499Z
Build Type: Stable
Release Track: Default
Electron: 39.6.0
Chromium: 142.0.7444.265
Node.js: 22.22.0
V8: 14.2.231.22-electron.0
OS: Darwin arm64 24.6.0

For AI issues: which model did you use?

Auto

Additional Information

It’s important to notice that I’m running the IDE through the Remote SSH extension, connected to a Linux server.

Does this stop you from using Cursor

No - Cursor works, but with this issue

Hey, thanks for the report. This is a bug. The UI shows remote branches without the origin/ prefix, but when creating a worktree it tries to resolve the bare branch name via git rev-parse, which can’t find the ref unless there’s a local copy.

The workaround you found (git fetch origin <branch>:<branch>) is currently the only option. It creates a local tracking branch, and then the name resolves correctly.

I’ve passed this to the team. There’s no timeline yet, but your report helps with prioritization.

1 Like