Q is not recognized as an internal or external command

Spurious ‘q’ Command After AI Assistant Terminal Commands

I’m experiencing the same issue with unexpected ‘q’ commands appearing after terminal output. Here’s my detailed experience to add to the existing reports:

My Environment

  • Remote Server: Linux 5.4.0-215-generic #235-Ubuntu (accessed via SSH)

  • Remote Shell: zsh 5.8

  • Cursor Version: 0.50.4 (user setup)

  • VSCode Version: 1.96.2

  • Electron: 34.3.4

  • Node.js: 20.18.3

  • Local Client OS: Windows 10.0.19045 x64

  • Connection: Remote SSH from Windows to Linux server

Specific Behavior I’m Seeing

After every terminal command executed by the AI assistant in the remote SSH session:

  1. The command executes correctly and shows output

  2. A “zsh: command not found: q” error appears automatically

  3. This ‘q’ command isn’t selectable/copyable in the output window

  4. The error appears consistently after every command

What’s interesting in my case:

  • This ONLY happens in Cursor’s remote SSH output window

  • The same commands work fine in a direct SSH terminal session (outside Cursor)

  • It happens even though the AI assistant uses | cat to prevent pager behavior

  • The issue occurs specifically in the remote SSH context

Screenshot

The screenshot above shows:

  • AI assistant executing a command on remote SSH

  • Normal command output

  • The unexpected “q” error

  • Full chat interface context

Additional Observations

This seems related to how Cursor handles terminal output pagination in remote SSH sessions. Even though the AI is explicitly preventing pager usage (by appending | cat), something at the IDE level appears to be triggering this behavior. The remote SSH nature of the connection (Windows client → Linux SSH server) might be particularly relevant to the issue.

2 Likes