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

[BUG] Interactive CLI degrades over time, leading to UI lag and repeated timeout errors

Open jorge-correia-software opened this issue 10 months ago • 6 comments

Preflight Checklist

  • [x] I have searched existing issues and this hasn't been reported yet
  • [x] This is a single bug report (please file separate reports for different bugs)
  • [x] I am using the latest version of Claude Code

What's Wrong?

After several prompts in a single interactive Claude Code CLI session, the CLI appears to accumulate excessive context and enters a degraded state. Typing becomes noticeably slow, requests stall, retries loop, and eventually every request fails with the error:

Request timed out. Check your internet connection and proxy settings

This occurs even though the network connection is stable and other Claude interfaces continue to work normally.

What Should Happen?

  • Interactive sessions should remain responsive regardless of prompt count.
  • Context growth should be handled gracefully or trimmed.
  • Timeouts should reflect actual network failures, not internal degradation.
  • Retry logic should not worsen the degraded state.

Error Messages/Logs

Request timed out. Check your internet connection and proxy settings
Retrying in 32 seconds...

Steps to Reproduce

  1. Start an interactive Claude Code CLI session.
  2. Perform several sequential prompts involving code edits (e.g. refactors, theme changes, multi-file diffs).
  3. Allow the session to run for several minutes with accumulating context and streamed diffs.
  4. Observe increasing UI latency:
  • typing in the terminal becomes slow
  • cursor movement and redraw lag
  1. Eventually, requests stall and the CLI begins retrying.
  2. The CLI repeatedly outputs:

Request timed out. Check your internet connection and proxy settings Retrying in 32 seconds...

  1. From this point onward, no requests complete successfully until the CLI is restarted.

Claude Model

Opus

Is this a regression?

Yes, this worked in a previous version

Last Working Version

No response

Claude Code Version

2.1.5 (Claude Code)

Platform

Anthropic API

Operating System

Ubuntu/Debian Linux

Terminal/Shell

VS Code integrated terminal

Additional Information

No response

jorge-correia-software avatar Jan 12 '26 15:01 jorge-correia-software

Found 3 possible duplicate issues:

  1. https://github.com/anthropics/claude-code/issues/17590
  2. https://github.com/anthropics/claude-code/issues/14463
  3. https://github.com/anthropics/claude-code/issues/14461

This issue will be automatically closed as a duplicate in 3 days.

  • If your issue is a duplicate, please close it and 👍 the existing issue instead
  • To prevent auto-closure, add a comment or 👎 this comment

🤖 Generated with Claude Code

github-actions[bot] avatar Jan 12 '26 15:01 github-actions[bot]

👍 - I'm getting the same

adamvietnam avatar Jan 12 '26 16:01 adamvietnam

@jorge-correia-software I am also seeing the same problems in Claude Code v2.1.5, Ubuntu 24 server. I responded in another issue about similar issues. When the sluggishness occurs, check htop and see if one CPU core is pegged near 100%. This was my issue and only happens after some amount of token usage; new sessions do not have the issue until again some amount of token usage in the chat session. I downgraded to v2.0.76 and the issue does not re-occur.

trial123Zel avatar Jan 12 '26 17:01 trial123Zel

I downgraded to 2.1.0 and it fixes it - haven't had a chance to work out the exact version it breaks in yet.

On Mon, 12 Jan 2026 at 17:32, Parker H @.***> wrote:

trial123Zel left a comment (anthropics/claude-code#17711) https://github.com/anthropics/claude-code/issues/17711#issuecomment-3739688146

@jorge-correia-software https://github.com/jorge-correia-software I am also seeing the same problems in Claude Code v2.1.5, Ubuntu 24 server. I responded in another issue about similar issues. When the sluggishness occurs, check htop and see if one CPU core is pegged near 100%. This was my issue and only happens after some amount of token usage; new sessions do not have the issue until again some amount of token usage in the chat session. I downgraded to v2.0.76 and the issue does not re-occur.

— Reply to this email directly, view it on GitHub https://github.com/anthropics/claude-code/issues/17711#issuecomment-3739688146, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAIS7TFIX54ZUYLJANWK4TT4GPLCNAVCNFSM6AAAAACRNXDIHSVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZTOMZZGY4DQMJUGY . You are receiving this because you commented.Message ID: @.***>

adamvietnam avatar Jan 12 '26 19:01 adamvietnam

I've seen this on 2.1.4 and 2.1.5 on Windows/WSL. 2.1.5 seems fine on macOS 26.2 but I wasn't paying attention to the context window size.

bowyern avatar Jan 12 '26 22:01 bowyern

I've seen this starting today (1/12) on 2.1.5 (Claude Code)

Typing in the terminal is INSANELY slow and makes me want to claw my eyes out of my head with a dull knife.

I've resorted to typing in an editor and pasting in my side of the conversation, and the paste takes 0.5-2 seconds.

Completely restarting the terminal does not help; if you use "claude -c" to resume the conversation - whatever is going wrong - persists.

walt93 avatar Jan 13 '26 00:01 walt93

The bug appears to be due to an extreme amount of whitespace appearing in the terminal window and hence the conversation history. For some reason, this results in the terminal becoming slower and slower and also the api timing out. Once the api starts timing out, claude code pretty much can't do anything at this point.

To solve it, export your conversation to a txt file, open it in a text editor, remove all of the trailing whitespace, restart a fresh claude session and then import the cleaned up conversation. The conversation file will should be 50-70% smaller, and claude code will resume operating normally - until it fills up with whitespace again and you need to repeat the process.

This is on 2.1.5 btw.

pdcruze avatar Jan 13 '26 03:01 pdcruze

I experienced the same issue on 2.1.5, upgrading to 2.1.6 didn't fix it. Downgraded to 2.0.76 but I noticed I couldn't resume any session that was running and 2.1.6 (or likely also 2.1.5) due to an error on resume (Cannot read property 'trim' of undefined, or something similar to that). So I tried 2.1.1 - it seems to have fixed it and allows me to restore sessions, so I'll ride this for now. I seem to recall that 2.1.3 was also working fine but I haven't had time to fully test it yet.

SamuelBolduc avatar Jan 13 '26 16:01 SamuelBolduc

I have been noticing this as well, never had the issue before this week. The terminal just gradually slows down over time until each keystroke takes 500ms+ to render.

caschoener avatar Jan 13 '26 17:01 caschoener

input lag through the roof

JaysTilted avatar Jan 19 '26 17:01 JaysTilted

Experiencing this often lately. Happens on extended conversations. JavaScript is not the language to build a long-running application in. I see this same type of issue eventually in any JS project of a certain size. Claude Code is also currently taking 2.68GB RAM in a TERMINAL APPLICATION, yet ANOTHER problem I often see in projects built in JS.

pmarreck avatar Jan 21 '26 03:01 pmarreck

I switched to native install Claude Code v2.1.19 and this resolved it for me (mac OS).

matthewhegarty avatar Jan 24 '26 16:01 matthewhegarty

I was getting the same thing. It definitely appeared to be a cli problem rather than anything related to the backend. It started ok, but then after a couple of prompts CPU would be pegged to 100% and it would be extremely laggy.

I have done the same as @matthewhegarty - I used claude install to switch to the native install and updated to 2.1.23. It appears much better now.

gravelld avatar Jan 29 '26 15:01 gravelld

I confirm too that using native claude install resolved the problem in 2.17

adamvietnam avatar Jan 29 '26 16:01 adamvietnam

same

On Thu, Jan 29, 2026 at 10:07 AM Adam Smith @.***> wrote:

adamvietnam left a comment (anthropics/claude-code#17711) https://github.com/anthropics/claude-code/issues/17711#issuecomment-3818644588

I confirm too that using native claude install resolved the problem in 2.17

— Reply to this email directly, view it on GitHub https://github.com/anthropics/claude-code/issues/17711#issuecomment-3818644588, or unsubscribe https://github.com/notifications/unsubscribe-auth/BRZW4NHD2FAS366Z4AYGFRT4JIV4HAVCNFSM6AAAAACRNXDIHSVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZTQMJYGY2DINJYHA . You are receiving this because you commented.Message ID: @.***>

JaysTilted avatar Jan 29 '26 16:01 JaysTilted

I have also switched to native install. The slowdown/whitespace-trimming problem is gone, now backspacing hangs or works intermittently. FWIW, I'm using MobaXterm on Windows 10, ssh'd into a 'remote' but local behind my NAT.

trial123Zel avatar Jan 29 '26 16:01 trial123Zel

I've now switched to native install and am having the same issues still on long contexts :/

pmarreck avatar Jan 29 '26 18:01 pmarreck

Experiencing same issue on macOS + Ghostty. Resumed session with 4.1GB conversation.json causes severe input lag (~500ms+ per keystroke).

Happens both with and without PTY wrapper. The issue persists even in a freshly opened tab in the same terminal session.

Additional observation: The claude process consumes 110% CPU while completely idle (no active request, just sitting at the prompt). This suggests continuous background processing of the large context.

Environment: macOS 15.3, Ghostty, Claude Code 2.1.27, Opus 4.5

kuzmeech avatar Jan 31 '26 04:01 kuzmeech

Follow-up: sample output for the idle process consuming 110% CPU:

Physical footprint:         581.2M
Physical footprint (peak):  4.0G

Main thread is 100% busy (2499/2499 samples) while the CLI is completely idle at the prompt. No symbols available in stripped binary, but clearly an event loop or polling mechanism that doesn't yield when there's no work.

Full sample: process appears to be doing continuous work in the main thread even with no user input or API activity.

kuzmeech avatar Jan 31 '26 04:01 kuzmeech

Request for debug assistance:

I have the problematic session readily reproducible (4.1GB context, 110% CPU while idle). Would be happy to help debug this further if Anthropic could:

  1. Provide debug symbols (dSYM) for the current release so I can get meaningful stack traces from sample/Instruments
  2. Or share a debug build with symbols intact
  3. Or point me to a bug bounty / beta tester program where I could help investigate performance issues like this

I can provide:

  • Full sample output with symbols
  • Instruments Time Profiler traces
  • Memory graphs
  • The problematic conversation.json (sanitized if needed)

This seems like a significant issue affecting users with long-running sessions, and I'd like to help get to the root cause.

kuzmeech avatar Jan 31 '26 04:01 kuzmeech