claude-code icon indicating copy to clipboard operation
claude-code copied to clipboard

Claude in iTerm2 will unpredictably scroll through the entire shell stdout history while executing commands

Open andrewreece opened this issue 9 months ago • 19 comments

I've observed this behavior every day at least once for about a week. I don't see an obvious pattern to this behavior, it will even start and stop in the same session. I would say this happens about 1 in every 100 commands (really rough estimate) and persists for 5-20 commands before stopping. For example, out of the last 50 commands, the middle 15 or so did this scrolling thing. It doesn't actually stop Claude from executing commands, it is something that happens while it is working on a request.

I made a screencast of the behavior but it shows private data when it scrolls, and I can't reliably reproduce it on test data. It doesn't seem to affect functionality, although today I noticed that Claude started using cat and echo in scripts instead of using its write file tool and direct messaging with me—this seemed to happen right around when the scrolling issue started up.

Tricky bug report to file, apologies it's not more detailed.

Claude version: 0.2.32 Mac OS Sonoma

andrewreece avatar Mar 06 '25 17:03 andrewreece

Something similar in default terminal on a Chromebook. I have to hit space bar or some other hopefully harmless key to snap it back into current state...

danbri avatar Mar 06 '25 20:03 danbri

When you say "scroll through the entire shell stdout history", do you mean Claude Code's entire history from the start of this session?

reverie avatar Mar 06 '25 20:03 reverie

It's hard to know for sure, but yes, it seems like that - it's a very rapid display of output on the screen, too fast to read, but it does seem roughly about as long as the history during that session.

Update: It seems like it may start when a user inputs a prompt past a certain number of newlines.

andrewreece avatar Mar 07 '25 00:03 andrewreece

I think i've seen this same behavior. And if I compact then I can still compact again when in this state and sometimes even again

BranchManager69 avatar Mar 13 '25 01:03 BranchManager69

Same here with powershell 7.5.0

Sometimes, it seems like the content of Claude console tries to "instantly refresh to add content" but that triggers some fast scrolling from the beginning to the end. Just like when console software tries to quickly flush and rewrite the content (with some modifications) to give the illusion of interactive content, but rewriting takes too many seconds.

When that happens and there is a multiple choice (yes; yes and don't ask again for this session; no and tell Claude what to do instead), pressing the down arrow key to change answer, also triggers that fast "redraw-scrolling".

SigismondPhilippe avatar Apr 06 '25 10:04 SigismondPhilippe

Same here using conemu with a WSL shell. It works great, but insists on starting at the top of the content for this session and scrolling down again.

Although - I have just migrated from a global install to local, and it seems to have stopped. Not sure whether that was coincidence, but might be worth trying?

EDIT: That didn't fix it

ap1969 avatar May 22 '25 19:05 ap1969

Same problem

Kuzyashin avatar Jun 21 '25 17:06 Kuzyashin

same problem with iterm2 + zsh on mac, after a couple of messages claude code starts to reset to the start of the shell history and rapidly scroll the entire length, then starts looping on that on every message it does after a certain point, forcing a terminal kill (cmd + c, space, enter, etc.. workarounds work sometimes but rarely)

MichaelHindley avatar Jul 03 '25 09:07 MichaelHindley

to somewhat mitigate this you can scroll your view all the way to the bottom and press enter. it will still do a quick scroll around but it'll be super quick vs long scroll loops

Image

daaddd avatar Jul 07 '25 16:07 daaddd

I can confirm, I'm experiencing this. It definitely has something to do with long history. If you work in a long session and run multiple /clear commands, it will happen eventually. I've tried closing CC and clearing the terminal history, setting different history line limits 1000, infinite in my iTerm. Nothing stops this from happening eventually.

ingmferrer avatar Jul 08 '25 00:07 ingmferrer

same

tarponjargon avatar Jul 19 '25 17:07 tarponjargon

Same. My use case is ssh from a mobile device into a tmux session, and I regularly have to sit through two or three minutes of intense (and eye bleeding) buffer re-scrolling - in a session length of 2days + the chances seem to be approaching 100% that this will become irrecoverable and I have to kill the tmux session and start over.

gjhilton avatar Jul 24 '25 12:07 gjhilton

same, on wsl bash terminal in vscode, i call it 'cc scroll of death' - also happens in Gemini CLI, first one to tackle this will definitely get a bonus, come on, you guys! this is a bummer, happens all the time context window is large enough to require much scrolling..

mlpassos avatar Jul 25 '25 00:07 mlpassos

Also facing this; I believe it's related to copy-pasting logs etc into claude code.

andreadellacorte avatar Jul 31 '25 07:07 andreadellacorte

If you don't need it, clear scrollback buffer under the edit menu in iTerm makes life easier.

BenHall avatar Aug 03 '25 09:08 BenHall

Getting this in Ubuntu GNOME terminal too. And the vscode terminal. And in IntelliJ IDEA. whatever terminal control library Claude is using sometimes gets into a state and then everything goes disco mode. Currently every time I switch terminal back to claude I get this:

https://github.com/user-attachments/assets/8d6dbc65-3290-45f5-b345-7d76c5303055

Apparently duplicate or related issues: #769 #1486 #1854 #2761

Would be lovely to fix this, or else put a warning about strobe effects (!)

(edit: the screencap didn't work as well as I'd like, in reality you see it redrawing apparently from the beginning of history about three times before it settles down. I only "switched tabs" here, I pressed no other key)

mattgodbolt avatar Aug 12 '25 19:08 mattgodbolt

I see this issue on MacOS 15.6.1 using tmux in kitty, but not without tmux in kitty.

dewaldabrie avatar Oct 29 '25 10:10 dewaldabrie