Where does the bug appear (feature/product)?
Cursor IDE
Describe the Bug
Summary
If a chat / agent is the last-selected one when its workspace folder is later deleted on disk (e.g., a git worktree is pruned, a project folder is moved or removed), Cursor repeatedly fails to launch the terminal for that chat — and the error then surfaces even when clicking unrelated, healthy chats, because the orphaned chat is still being re-opened in the background. Restarting Cursor doesn’t help until you explicitly select a different chat.
The error message:
The terminal process failed to launch: Starting directory (cwd) “
/path/to/stale” does not exist.
What seems to be happening
After poking around the persisted state in ~/Library/Application Support/Cursor/User/globalStorage/state.vscdb, the relevant pieces are:
composer.composerHeaders— the list of all chats, each with aworkspaceIdentifier.uri.fsPathand anisArchivedflag.selectedComposerId— the last-selected chat, persisted across restarts.composer.startupContribution— registered as a startup contribution; on launch it readsselectedComposerIdand re-opens that chat, which initializes its terminal panel against the chat’s stored cwd.
The startup-reopen path filters out chats withisWorktree === true(Cursor’s own worktree-composer flag) but does not check whether the chat’sworkspaceIdentifier.uri.fsPathstill exists on disk. So ordinary local chats whose folder has been deleted are still passed toopenComposer, which then tries to spawn a terminal at the missing path.
The same thing happens on the click handler: clicking any chat updatesselectedComposerIdto point at the orphaned one, so subsequent re-renders re-trigger the error.
Suggested fix
Before re-opening selectedComposerId on startup (and on click), check that the chat’s workspace folder still exists. If not, fall back to the next valid chat or clear the selection so the user can choose explicitly.
This would also make orphan chats behave gracefully instead of silently poisoning the panel.
Workaround
- Click any chat whose workspace still exists, so it becomes the selected one.
- Restart Cursor.
- (Optional) Archive the orphaned chats — archived chats are not auto-restored on startup.
Related
- Cursor should cleanup worktrees if chat was archived — different angle (cleanup of worktrees when chats are archived). This bug is the dual case: a chat lingering after the user has deleted its workspace.
Steps to Reproduce
- Open Cursor in a folder, e.g.
/Users/<user>/projects/foo. - Create a new chat / agent in that workspace and send it a message so it becomes the last-selected one.
- Quit Cursor.
- Delete the folder on disk:
rm -rf /Users/<user>/projects/foo. - Open Cursor again in any other workspace.
- Click any chat in the sidebar.
Expected: clicking a healthy chat opens it normally.
Actual: an error toast appears:The terminal process failed to launch: Starting directory (cwd) "/Users/<user>/projects/foo" does not exist.It keeps firing on every panel re-render and on every Cursor restart, regardless of which chat you click, until a different chat is explicitly selected.
Expected Behavior
No error message pops up
Operating System
MacOS
Version Information
Version: 3.2.11
VSCode Version: 1.105.1
Commit: e9ee1339915a927dfb2df4a836dd9c8337e17cc0
Date: 2026-04-24T14:36:47.933Z
Layout: glass
Build Type: Stable
Release Track: Default
Electron: 39.8.1
Chromium: 142.0.7444.265
Node.js: 22.22.1
V8: 14.2.231.22-electron.0
OS: Darwin arm64 25.4.0
Does this stop you from using Cursor
No - Cursor works, but with this issue