Where does the bug appear (feature/product)?
Cursor IDE
Describe the Bug
Description:
Cursor is unable to properly switch between workspaces and worktrees, which blocks our experiments from running normally. The failure occurs because Cursor’s git fetch command is aborted by unrelated Bash completion errors, even though Git itself succeeds.
Error Message:
Failed to move agent root: Failed to checkout migrated branch "codex/dune-case-studies":
git fetch origin +refs/heads/codex/dune-case-studies:refs/remotes/origin/codex/dune-case-studies --no-tags --recurse-submodules=no --no-write-fetch-head: Command failed: git fetch origin +refs/heads/codex/dune-case-studies:refs/remotes/origin/codex/dune-case-studies --no-tags --recurse-submodules=no --no-write-fetch-head
/usr/share/bash-completion/bash_completion: line 45: shopt: progcomp: invalid shell option name
/usr/share/bash-completion/bash_completion: line 53: complete: command not found
/usr/share/bash-completion/bash_completion: line 56: complete: command not found
/usr/share/bash-completion/bash_completion: line 59: complete: command not found
/usr/share/bash-completion/bash_completion: line 62: complete: command not found
/usr/share/bash-completion/bash_completion: line 65: complete: command not found
/usr/share/bash-completion/bash_completion: line 68: complete: command not found
...
Root Cause Analysis:
The issue is not caused by the Git version — the host is running Git 2.55.0, which is recent and fully supports worktrees.
The actual cause is a shell environment incompatibility. When Cursor executes the git fetch command, it appears to spawn a shell that sources /usr/share/bash-completion/bash_completion. In that shell, the script fails because:
shopt -s progcompis reported as an invalid shell option- The
completebuiltin is reported as not found
Notably, the host is running GNU Bash 5.0.17(1)-release, which does support both progcomp and complete. This strongly suggests that Cursor is not spawning a full Bash shell — on Ubuntu 20.04, /bin/sh is symlinked to dash by default. dash does not support shopt or complete, yet the bash-completion script is still being sourced. This would fully explain the errors.
These errors are written to the output stream, which causes Cursor to treat the Git command as failed — even though the failure is unrelated to Git itself. As a result, Cursor aborts the workspace/worktree switch.
Questions / Requests:
- Can Cursor avoid sourcing
bash_completionwhen running Git commands in non-interactive shells? For example, by usingbash --noprofile --norc, or by explicitly settingBASH_ENVto empty. - Can Cursor ensure it spawns a proper, full Bash (
/bin/bash) rather than a minimal or POSIX-compliant shell such asdash? - Can Cursor distinguish between actual Git failures and unrelated shell initialization warnings? These Bash completion errors should not block the workflow.
- Could Cursor harden its shell invocation to be robust against incomplete or minimal shell environments (e.g., in containers, CI, or minimal server installs)?
Environment:
- Cursor version: 3.22.7
- Host Git version: 2.55.0
- Host Bash version: GNU bash, version 5.0.17(1)-release (x86_64-pc-linux-gnu)
- OS: Ubuntu 20.04.6 LTS (Focal Fossa)
- Kernel: Linux epyc-7t83 7.2.0-coconut-svsm-host-97828317fc1d #1 SMP PREEMPT_DYNAMIC Fri Sep 11 14:04:58 CST 2026 x86_64 GNU/Linux
One last check before posting (optional but recommended):
Run this on the host and include the output — it will confirm whether /bin/sh is dash, which is the most likely culprit:
ls -l /bin/sh
If it shows /bin/sh -> dash, that’s the smoking gun. Adding one line like “/bin/sh is symlinked to dash on this host” will make your report much easier for the Cursor team to act on.
If you’d like, I can also draft a short, polite follow-up reply for when a maintainer responds to your thread.
Steps to Reproduce
Switch worktree and checkout branch on the Cursor Agent.
Operating System
MacOS
Version Information
macOS Tahoe
Does this stop you from using Cursor
No - Cursor works, but with this issue