Where does the bug appear (feature/product)?
Cursor IDE
Describe the Bug
When using Cursor inside a Dev Container, the “Apply” button for worktree changes fails with the error:
Failed to apply worktree to current branch: Unable to read file ‘vscode-remote://dev-container+{hex-encoded-path}/…’
The error contains a vscode-remote:// URI with a hex-encoded container path, suggesting Cursor is trying to resolve the worktree files via the remote URI scheme rather than the local filesystem.
Root Cause Analysis
When Cursor creates worktrees inside a Dev Container:
- The main repo is at
/app(on thedevelopbranch, for example) - Cursor creates worktrees at
~/.cursor/worktrees/<encoded-name>/<id>in detached HEAD state - The worktree’s
.gitfile correctly containsgitdir: /app/.git/worktrees/<id> - However, when “Apply” tries to read files from the worktree, it constructs a
vscode-remote://URI instead of using the local filesystem path, which it then cannot resolve
Steps to Reproduce
- Create a project with a
.devcontainer/devcontainer.json:
{
"name": "my-devcontainer",
"image": "mcr.microsoft.com/devcontainers/base:ubuntu",
"workspaceFolder": "/app"
}
- Initialize a git repo and make at least one commit:
cd /app
git init
git add .
git commit -m "initial commit"
- Open the project in Cursor and attach to the Dev Container.
- Open the Agent panel and select “Run in worktree” from the dropdown.
- Ask the agent to make any file edit (e.g. “add a comment to file X”).
- Wait for the agent to complete.
- Click the “Apply” button to merge changes back to the main working tree.
Expected Behavior
Changes from the worktree should be merged into the primary working tree at /app, as described in the Parallel Agents documentation.
Actual Behavior
The Apply button fails with:
Failed to apply worktree to current branch: Unable to read file ‘vscode-remote://dev-container+{hex}/…/filename’
No changes are applied. The worktree changes remain only in the Cursor-managed worktree under ~/.cursor/worktrees/.
Operating System
MacOS
Linux
Version Information
Version: 2.4.22
Commit: 618c607a249dd7fd2ffc662c6531143833bebd40
Arch: arm64
Git Version: 2.39.5
Does this stop you from using Cursor
Sometimes - I can sometimes use Cursor