Whenever the AI tries to run any terminal command over an SSH workspace, the output is always a series of shell errors:
--: line 2: ---: command not found
--: line 3: A: command not found
--: line 4: If: command not found
--: line 5: Tue: command not found
--: line 6: --------------------------------: command not found
--: line 1: dump_bash_state: command not found
The command never runs.
This happens for every command and only on Remote SSH.
The normal integrated terminal works fine; only the AI/Agent-powered terminal is broken.
Steps to Reproduce
Open Cursor
Connect to any remote server using SSH Workspace
Ask the AI to run a command (e.g., “run ls”)
AI attempts to run it → the terminal immediately prints the errors above
No command ever actually executes
This is 100% reproducible on Remote SSH.
Expected Behavior
AI Terminal should inject its shell state, start correctly, and execute commands normally inside an SSH workspace.
Shell config: No custom .bashrc or .bash_profile on the remote. I do use a customized .zshrc, but since the AI terminal initializes a non-interactive bash shell, none of my zsh config should be running there.
Remote SSH Output panel: I don’t see any errors in View → Output → Remote SSH. The panel stays completely clean even when the AI terminal fails.
Let me know if there’s anything else I can collect!
On my remote machine I had this in ~/.bash_profile:
exec zsh
I originally needed this because chsh doesn’t work in my environment (network-managed accounts), so the only way to get zsh as my default login shell was to force bash to exec into it.
I fixed it by guarding the shell switch:
# ~/.bash_profile
# Skip switching to zsh when Cursor Agent is running
if [[ -n "$CURSOR_AGENT" ]]; then
:
else
exec zsh
fi
Now normal SSH sessions still give me zsh, and the Cursor AI terminal works correctly.