Terminal tool fails to process command output with 'head/cat: No such file or directory' errors

Terminal tool fails to process command output with ‘head/cat: No such file or directory’ errors

Issue

I routinely - but not systematically - run into this error. The model seems to silently add a | cat / | head (silently because it doesn’t show it in the display when it prints the command it is running) to commands it suspects will trigger a terminal paging (which could stuck it), but it fails at doing so, causing these errors on most commands that return data:

head: |: No such file or directory
head: cat: No such file or directory

I asked Claude-4 what it thinks is happening :

The tool implementation is incorrectly trying to process command output with head/cat internally, which breaks normal command execution.

Claude is pretty vague and keep talking about “the tool”, but I understand it as “Cursor”.
From what I have seen, it looks like all models are affected. I reproduced with all Claude models and GPT 4.1 (and then I stopped testing).

Reproduction

Not sure, but, any command that outputs data through the AI terminal tool:

  • gh pr list → fails with head/cat errors
  • gh run list → fails with head/cat errors
  • gh --version → works fine (no data output)
  • echo "test" | cat → works fine (basic pipe)

This instruction should do:

I have the gh cli installed. Get me result of the last CI run on this branch

Environment

  • macOS 15.4.1
  • zsh 5.9
  • Cursor 1.0.0
3 Likes

Same here — I see it with aws commands it’s trying to do for troubleshooting. In the specific case of aws, adding the --no-cli-pager switch seems to fix it.

1 Like

Omg you are right, I can avoid the issue by setting gh config set pager cat.
But on the other hand, the model on the other side confirms me that he is receiving a corrupt output from Cursor when paging is involved. I wish someone from cursor could read this message.

Facing same issue with aws cli.

Also encountering this issue, see my config below. Makes terminal interaction pretty clunky as I have to copy/paste the command into another terminal, copy/paste the input back – makes Cursor kinda less than useful.

Version: 1.1.3 (Universal)
VSCode Version: 1.96.2
Commit: 979ba33804ac150108481c14e0b5cb970bda3260
Date: 2025-06-15T06:37:17.379Z
Electron: 34.5.1
Chromium: 132.0.6834.210
Node.js: 20.19.0
V8: 13.2.152.41-electron.0
OS: Darwin arm64 24.5.0

I fixed it in my environment, and posted the full fix here: Command Output Errors: head: |: No such file or directory and head: cat: No such file or directory · Issue #3239 · cursor/cursor · GitHub