Agent "Worktree Setup" fails to find config file in Remote SSH sessions (URI Resolution Error)

Where does the bug appear (feature/product)?

Cursor IDE

Describe the Bug

When using the Agent (Composer) in a Remote SSH environment, the automatic worktree setup fails to detect the .cursor/worktrees.json configuration file. The Agent correctly creates the ephemeral worktree and the file physically exists on the remote disk, but the internal check fails with “no config file found,” causing the setup commands (e.g., make install-dev) to be skipped.

It appears the Agent is attempting to validate the config existence using a file:// URI that does not correctly resolve to the remote SSH file system context.

Steps to Reproduce

  1. Connect to a remote Linux host via SSH using Cursor.
  2. In the root workspace, create .cursor/worktrees.json:
{
  "setup-worktree": ["echo 'hello'"]
}

  1. Commit the file to git (to ensure it propagates to new worktrees).
  2. Launch an Agent/Composer session that requires a worktree.
  3. Observe the Agent logs (Worktree Setup).

Expected Behavior

The Agent detects the worktrees.json file inside the new worktree path and executes the setup commands.

Screenshots / Screen Recordings

Operating System

Linux

Current Cursor Version (Menu → About Cursor → Copy)

Version: 2.3.35
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: Linux x64 6.14.0-1019-oem

Additional Information

Logs & Evidence

1. The Agent Log (showing the failure):

[2026-01-16T10:36:42.474Z] [worktree-setup] checking config
{
  "worktreePath": "/fastdata/users/lefos/.cursor/worktrees/wsi-patch-datasets__SSH__okocha_/gev",
  "rootWorkspacePath": "/fastdata/users/lefos/code/wsi-patch-datasets",
  "worktreeConfigFile": "file:///fastdata/users/lefos/.cursor/worktrees/wsi-patch-datasets__SSH__okocha_/gev/.cursor/worktrees.json",
  "rootConfigFile": "file:///fastdata/users/lefos/code/wsi-patch-datasets/.cursor/worktrees.json",
  "isTargetWindows": false,
  "remoteOS": 3
}
[2026-01-16T10:36:42.481Z] [worktree-setup] no config file found in worktree or root, skipping

2. Proof of File Existence (Terminal):
The file does exist at the path logged above:

$ ls -l /fastdata/users/lefos/.cursor/worktrees/wsi-patch-datasets__SSH__okocha_/gev/.cursor/worktrees.json
-rw-rw-r-- 1 lefos lefos 53 Jan 16 11:04 /fastdata/users/lefos/.cursor/worktrees/wsi-patch-datasets__SSH__okocha_/gev/.cursor/worktrees.json

Does this stop you from using Cursor

No - Cursor works, but with this issue

Hey, thanks for the report. This is a known issue with worktrees in remote environments (SSH, WSL, devcontainers). The agent uses a file:// URI to check the config, and it doesn’t resolve correctly in a remote context.

The team is aware, and we’re tracking it along with similar issues for WSL and devcontainers. Unfortunately, there’s no workaround yet, so worktree setup scripts won’t work in remote SSH sessions until this is fixed.

I’ll keep the thread updated when there’s news.

1 Like

Nice, thank you very much! :folded_hands: