Q is not recognized as an internal or external command

I get this every time Cursor runs a command:

image

What do i need to change in my settings to not get this error every time?

15 Likes

I’m having the same issue. Come on guys, I’m paying for this out of my own pocket.

4 Likes

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.

3 Likes

Has anyone found a fix for this?

3 Likes

I’m getting this issue as well. Typically when Cursor tries to do something like run unit tests, or echo the date and time.

Oddly the commands often seem to run OK, and it seems that Cursor can process the output.

But still, it would be nice to have a fix for this. Maybe it’s paranoia but seeing an error message like this i get the discomforting feeling that something is secretly going wrong and things could be getting broken underneath somehow.

C:\>q^D^C
'q♦♥' is not recognized as an internal or external command,
operable program or batch file.
2 Likes

I’m also experiencing this problem, constantly. I tried copying and pasting, but when I select and copy, it seems to be copying something else, or maybe nothing. I’m not sure.

2 Likes

ADD this to your instruction to unblock while the team comes back from holidays

DO NOT USE && IN COMMANDS
2 Likes

This doesn’t solve the problem.

1 Like

I am having the same issue. Is it reported to Cursor DEV team?

Cursor just solved this issue for me:

Same here, none of the solutions have worked

It works for me now. See my previous post.

For me what solved it was setting bash as the main terminal (Windows machine).

1 Like

Open your zsh configuration file:

bash

nano ~/.zshrc

Add this line:

bash

alias q='exit'

Then reload your configuration:

bash

source ~/.zshrc
2 Likes

I am on Windows. So this does not work.

More specifically

2 Likes

Any movement on this? It’s quite annoying and still happening.

My setup:

OS: Linux 5.15.167.4-microsoft-standard-WSL2 x86_64
Zsh: 5.9
Shell: /usr/local/bin/zsh

I have tried:

  • Switching to bash in Cursor
  • The cursor options already mentioned in this thread.
  • Disabling the pager

It does look like it’s trying to exit out of a pager with Q or something

not work in osx

I also am experiencing a spurious ‘q’ with the WSL/Ubuntu terminal in Windows, though in my case it seems to be prepended to every command rather than appended after the command. Setting an alias won’t work because there’s no space. For instance, python3 --version becomes qpython3 --version.

Here’s how I solved it:

  1. Ctrl + Shift + P to open command palette
  2. Select “WSL: Connect to WSL using Distro” and then select your distribution (Ubuntu in my case)
  3. Click “Browse” and select a folder from the Ubuntu file system (note: make sure not to click a Windows folder from the “recent” list, as this will disconnect you from WSL)

My mistake was that, even though I had the WSL extension installed, Cursor opened to an Ubuntu folder, and an Ubuntu terminal open, I hadn’t followed this process to properly tunnel to the WSL remote.

1 Like