Neting_Srl
(Neting Srl)
February 10, 2026, 9:44am
1
Where does the bug appear (feature/product)?
Cursor IDE
Describe the Bug
I have this .cursor\worktrees.json
{
"setup-worktree": [
"pnpm install",
"pnpm db:generate",
"cp $ROOT_WORKTREE_PATH/.env .env"
]
}
When I create a new chat and select “worktree” as where to run the agent, using only one model, the worktree setup doesn’t run
Steps to Reproduce
Open a new chat
Below the chat box, select “Worktree”
Start the request
Expected Behavior
The worktree setup shoud run before the the request is sent to the AI model.
Screenshots / Screen Recordings
Operating System
Windows 10/11
Version Information
Version: 2.4.31 (user setup)
VSCode Version: 1.105.1
Commit: 3578107fdf149b00059ddad37048220e41681000
Date: 2026-02-08T07:42:24.999Z
Build Type: Stable
Release Track: Default
Electron: 39.2.7
Chromium: 142.0.7444.235
Node.js: 22.21.1
V8: 14.2.231.21-electron.0
OS: Windows_NT x64 10.0.26200
Does this stop you from using Cursor
No - Cursor works, but with this issue
deanrie
(Dean Rie)
February 10, 2026, 4:35pm
3
Hey, thanks for the report. There are a few things worth checking:
Open the Output panel (View > Output) and pick “Worktrees Setup” from the dropdown. Does it show anything when you run a single-model worktree run? Any errors, or is it completely empty?
Does the setup work correctly if you use “Use multiple models” (best-of-N) instead of a single model?
Since you’re on Windows, try adding a setup-worktree-windows key next to the existing setup-worktree. It takes priority on Windows:
{
"setup-worktree-windows": [
"pnpm install",
"pnpm db:generate",
"copy %ROOT_WORKTREE_PATH%\\.env .env"
],
"setup-worktree": [
"pnpm install",
"pnpm db:generate",
"cp $ROOT_WORKTREE_PATH/.env .env"
]
}
The Output panel logs should help narrow it down, whether the setup process is actually starting or if it’s failing silently. Let me know what you find.
Neting_Srl
(Neting Srl)
February 12, 2026, 1:43pm
4
I added the setup-worktree-windows as you said. This is the Output log of the “Worktrees Setup”.
[2026-02-12T13:32:24.161Z] [worktree-setup] checking config
{"composerId":"5be173a1-53fe-4864-9ae1-f3963b74d15f","worktreePath":"C:\\Users\\user\\.cursor\\worktrees\\artcalendar-app__Workspace_\\sme","rootWorkspacePath":"C:\\Users\\user\\Documents\\GitHub\\artcalendar-app","worktreeConfigFile":"file:///c%3A/Users/user/.cursor/worktrees/artcalendar-app__Workspace_/sme/.cursor/worktrees.json","rootConfigFile":"file:///c%3A/Users/user/Documents/GitHub/artcalendar-app/.cursor/worktrees.json","isTargetWindows":true}
[2026-02-12T13:32:24.165Z] [worktree-setup] selected setup spec
{"key":"setup-worktree","hasCommands":true,"hasScript":false,"configPath":"file:///c%3A/Users/user/.cursor/worktrees/artcalendar-app__Workspace_/sme/.cursor/worktrees.json"}
[2026-02-12T13:32:24.197Z] [worktree-setup] started terminal session
{"sessionId":"a8d7f7b4-5b54-4685-844b-c8fd5005eeea","worktreePath":"C:\\Users\\user\\.cursor\\worktrees\\artcalendar-app__Workspace_\\sme"}
[2026-02-12T13:32:24.198Z] [worktree-setup] executing combined Windows script with per-command logs
{"worktreePath":"C:\\Users\\user\\.cursor\\worktrees\\artcalendar-app__Workspace_\\sme","scriptLength":1097}
--: eval: line 1: syntax error near unexpected token `('
--: eval: line 1: `$ErrorActionPreference = 'Stop'; Set-Location -LiteralPath "C:\Users\user\.cursor\worktrees\artcalendar-app__Workspace_\sme"; $env:ROOT_WORKTREE_PATH = "C:\Users\user\Documents\GitHub\artcalendar-app"; Write-Host '[worktree-setup] Working directory: ' (Get-Location); Write-Host "[worktree-setup] [0] $ pnpm install"; pnpm install; if ($LASTEXITCODE -ne $null -and $LASTEXITCODE -ne 0) { Write-Host "[worktree-setup] [0] failed with exit code $LASTEXITCODE"; exit $LASTEXITCODE } else { Write-Host "[worktree-setup] [0] done" }; Write-Host "[worktree-setup] [1] $ pnpm db:generate"; pnpm db:generate; if ($LASTEXITCODE -ne $null -and $LASTEXITCODE -ne 0) { Write-Host "[worktree-setup] [1] failed with exit code $LASTEXITCODE"; exit $LASTEXITCODE } else { Write-Host "[worktree-setup] [1] done" }; Write-Host "[worktree-setup] [2] $ cp $ROOT_WORKTREE_PATH/.env .env"; cp $ROOT_WORKTREE_PATH/.env .env; if ($LASTEXITCODE -ne $null -and $LASTEXITCODE -ne 0) { Write-Host "[worktree-setup] [2] failed with exit code $LASTEXITCODE"; exit $LASTEXITCODE } else { Write-Host "[worktree-setup] [2] done" }'
[2026-02-12T13:32:25.530Z] [worktree-setup] all commands finished
{"durationMs":1365}
[2026-02-12T13:32:25.531Z] [worktree-setup] ended terminal session
{"sessionId":"a8d7f7b4-5b54-4685-844b-c8fd5005eeea"}
I tried also with multiple models and the setup doesn’t work. These are the logs
[2026-02-12T13:38:01.711Z] [worktree-setup] checking config
{"composerId":"74e55797-6be6-4a24-937b-6d9799140005","worktreePath":"C:\\Users\\user\\.cursor\\worktrees\\artcalendar-app__Workspace_\\zgh","rootWorkspacePath":"C:\\Users\\user\\Documents\\GitHub\\artcalendar-app","worktreeConfigFile":"file:///c%3A/Users/user/.cursor/worktrees/artcalendar-app__Workspace_/zgh/.cursor/worktrees.json","rootConfigFile":"file:///c%3A/Users/user/Documents/GitHub/artcalendar-app/.cursor/worktrees.json","isTargetWindows":true}
[2026-02-12T13:38:01.727Z] [worktree-setup] selected setup spec
{"key":"setup-worktree","hasCommands":true,"hasScript":false,"configPath":"file:///c%3A/Users/user/.cursor/worktrees/artcalendar-app__Workspace_/zgh/.cursor/worktrees.json"}
[2026-02-12T13:38:01.746Z] [worktree-setup] started terminal session
{"sessionId":"3abfac18-a128-47c2-96fe-1130c5d33687","worktreePath":"C:\\Users\\user\\.cursor\\worktrees\\artcalendar-app__Workspace_\\zgh"}
[2026-02-12T13:38:01.746Z] [worktree-setup] executing combined Windows script with per-command logs
{"worktreePath":"C:\\Users\\user\\.cursor\\worktrees\\artcalendar-app__Workspace_\\zgh","scriptLength":1097}
--: eval: line 1: syntax error near unexpected token `('
--: eval: line 1: `$ErrorActionPreference = 'Stop'; Set-Location -LiteralPath "C:\Users\user\.cursor\worktrees\artcalendar-app__Workspace_\zgh"; $env:ROOT_WORKTREE_PATH = "C:\Users\user\Documents\GitHub\artcalendar-app"; Write-Host '[worktree-setup] Working directory: ' (Get-Location); Write-Host "[worktree-setup] [0] $ pnpm install"; pnpm install; if ($LASTEXITCODE -ne $null -and $LASTEXITCODE -ne 0) { Write-Host "[worktree-setup] [0] failed with exit code $LASTEXITCODE"; exit $LASTEXITCODE } else { Write-Host "[worktree-setup] [0] done" }; Write-Host "[worktree-setup] [1] $ pnpm db:generate"; pnpm db:generate; if ($LASTEXITCODE -ne $null -and $LASTEXITCODE -ne 0) { Write-Host "[worktree-setup] [1] failed with exit code $LASTEXITCODE"; exit $LASTEXITCODE } else { Write-Host "[worktree-setup] [1] done" }; Write-Host "[worktree-setup] [2] $ cp $ROOT_WORKTREE_PATH/.env .env"; cp $ROOT_WORKTREE_PATH/.env .env; if ($LASTEXITCODE -ne $null -and $LASTEXITCODE -ne 0) { Write-Host "[worktree-setup] [2] failed with exit code $LASTEXITCODE"; exit $LASTEXITCODE } else { Write-Host "[worktree-setup] [2] done" }'
[2026-02-12T13:38:03.096Z] [worktree-setup] all commands finished
{"durationMs":1369}
[2026-02-12T13:38:03.097Z] [worktree-setup] ended terminal session
{"sessionId":"3abfac18-a128-47c2-96fe-1130c5d33687"}
[2026-02-12T13:38:18.476Z] [worktree-setup] checking config
{"composerId":"2c7fd8c3-978b-4e32-96b0-c3489e7af9f9","worktreePath":"C:\\Users\\user\\.cursor\\worktrees\\artcalendar-app__Workspace_\\cjk","rootWorkspacePath":"C:\\Users\\user\\Documents\\GitHub\\artcalendar-app","worktreeConfigFile":"file:///c%3A/Users/user/.cursor/worktrees/artcalendar-app__Workspace_/cjk/.cursor/worktrees.json","rootConfigFile":"file:///c%3A/Users/user/Documents/GitHub/artcalendar-app/.cursor/worktrees.json","isTargetWindows":true}
[2026-02-12T13:38:18.496Z] [worktree-setup] selected setup spec
{"key":"setup-worktree-windows","hasCommands":true,"hasScript":false,"configPath":"file:///c%3A/Users/user/.cursor/worktrees/artcalendar-app__Workspace_/cjk/.cursor/worktrees.json"}
[2026-02-12T13:38:18.519Z] [worktree-setup] started terminal session
{"sessionId":"f264c4f9-e7df-4658-8dd0-d3fe44908ad4","worktreePath":"C:\\Users\\user\\.cursor\\worktrees\\artcalendar-app__Workspace_\\cjk"}
[2026-02-12T13:38:18.519Z] [worktree-setup] executing combined Windows script with per-command logs
{"worktreePath":"C:\\Users\\user\\.cursor\\worktrees\\artcalendar-app__Workspace_\\cjk","scriptLength":1103}
--: eval: line 1: syntax error near unexpected token `('
--: eval: line 1: `$ErrorActionPreference = 'Stop'; Set-Location -LiteralPath "C:\Users\user\.cursor\worktrees\artcalendar-app__Workspace_\cjk"; $env:ROOT_WORKTREE_PATH = "C:\Users\user\Documents\GitHub\artcalendar-app"; Write-Host '[worktree-setup] Working directory: ' (Get-Location); Write-Host "[worktree-setup] [0] $ pnpm install"; pnpm install; if ($LASTEXITCODE -ne $null -and $LASTEXITCODE -ne 0) { Write-Host "[worktree-setup] [0] failed with exit code $LASTEXITCODE"; exit $LASTEXITCODE } else { Write-Host "[worktree-setup] [0] done" }; Write-Host "[worktree-setup] [1] $ pnpm db:generate"; pnpm db:generate; if ($LASTEXITCODE -ne $null -and $LASTEXITCODE -ne 0) { Write-Host "[worktree-setup] [1] failed with exit code $LASTEXITCODE"; exit $LASTEXITCODE } else { Write-Host "[worktree-setup] [1] done" }; Write-Host "[worktree-setup] [2] $ copy %ROOT_WORKTREE_PATH%\.env .env"; copy %ROOT_WORKTREE_PATH%\.env .env; if ($LASTEXITCODE -ne $null -and $LASTEXITCODE -ne 0) { Write-Host "[worktree-setup] [2] failed with exit code $LASTEXITCODE"; exit $LASTEXITCODE } else { Write-Host "[worktree-setup] [2] done" }'
[2026-02-12T13:38:21.086Z] [worktree-setup] all commands finished
{"durationMs":2590}
[2026-02-12T13:38:21.088Z] [worktree-setup] ended terminal session
{"sessionId":"f264c4f9-e7df-4658-8dd0-d3fe44908ad4"}
stern87
(Eugene)
March 6, 2026, 8:02am
5
I have the same issue on mac. When this race-condition issue will be resolved?
system
(system)
Closed
March 28, 2026, 8:03am
6
This topic was automatically closed 22 days after the last reply. New replies are no longer allowed.