claude-code - 💡(How to fix) Fix [BUG] Claude Code freezes mid-response (up to 15 min with zero token raise), persists across sessions and models [1 comments, 2 participants]

Official PRs (…)
ON THIS PAGE

Recommended Tools

×6

Utilities matched from this issue’s tags and category — try them while you read without losing context.

GitHub issue graph ai analysis

Paste a GitHub issue URL. We fetch that issue, discover linked issues from bodies/comments/timeline, collect linked pull requests, and produce a structured English report.

The report is written in English Markdown for sharing and archival.

Helpful · Quick feedback

Loading…
GitHub stats
anthropics/claude-code#51659Fetched 2026-04-22 07:56:20
View on GitHub
Comments
1
Participants
2
Timeline
6
Reactions
0
Timeline (top)
labeled ×4closed ×1commented ×1

Error Message

Error Messages/Logs

If it recurs, check the transcript for API Error: Stream idle timeout before blaming me. Ready to work — what's on deck?

Root Cause

Claude Code has become virtually unusable for me, it gets stuck after every tool call, idles until time out or until I interrupt it. It also sometimes gets stuck on standard text communications. It has been unable to see the problem for itself from its perspective. Its self-diagnoses and failed fixes are based on it guessing. Once it a while it works perfectly with complicated tasks and most of the time it just doesn't do anything. It recognizes that it's getting held up, but can not self resolve because every time it tries, it gets stuck.

Code Example

This was its latest self diagnosis, but it doesn't recognize the larger picture. Right now it's identifying yesterday's attempt at fixing it as the primary issue. 

Environment:

Claude Code CLI, model: Opus 4.7 (1M context)
macOS Darwin 25.3.0, zsh
Issue persists across multiple sessions over several days
Symptom:

Assistant stalls mid-turn with no output for 30s to 4+ minutes
Happens during plain text generation (not just tool calls) — confirmed freezing at 19 tokens and 126 tokens on bare text responses
Happens after tool calls as well
Only resolvable by user interrupting
Other users on my team are not experiencing this
What I tried (did not help, may have made it worse):
Added env overrides in ~/.claude/settings.json:

"CLAUDE_ENABLE_STREAM_WATCHDOG": "1",
"CLAUDE_ENABLE_BYTE_WATCHDOG": "1",
"CLAUDE_STREAM_IDLE_TIMEOUT_MS": "900000",
"API_TIMEOUT_MS": "1200000",
"CLAUDE_CODE_MAX_RETRIES": "10",
"MAX_THINKING_TOKENS": "12000",
"CLAUDE_CODE_DISABLE_ADAPTIVE_THINKING": "1"
Question: Are these env vars even correct? Are there known issues with long freezes on Opus 4.7 1M context, or with these timeout overrides?
RAW_BUFFERClick to expand / collapse

Preflight Checklist

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

What's Wrong?

Claude Code has become virtually unusable for me, it gets stuck after every tool call, idles until time out or until I interrupt it. It also sometimes gets stuck on standard text communications. It has been unable to see the problem for itself from its perspective. Its self-diagnoses and failed fixes are based on it guessing. Once it a while it works perfectly with complicated tasks and most of the time it just doesn't do anything. It recognizes that it's getting held up, but can not self resolve because every time it tries, it gets stuck.

What Should Happen?

Claude should function as normal and finish out tasks without going idle until time out.

Error Messages/Logs

This was its latest self diagnosis, but it doesn't recognize the larger picture. Right now it's identifying yesterday's attempt at fixing it as the primary issue. 

Environment:

Claude Code CLI, model: Opus 4.7 (1M context)
macOS Darwin 25.3.0, zsh
Issue persists across multiple sessions over several days
Symptom:

Assistant stalls mid-turn with no output for 30s to 4+ minutes
Happens during plain text generation (not just tool calls) — confirmed freezing at 19 tokens and 126 tokens on bare text responses
Happens after tool calls as well
Only resolvable by user interrupting
Other users on my team are not experiencing this
What I tried (did not help, may have made it worse):
Added env overrides in ~/.claude/settings.json:

"CLAUDE_ENABLE_STREAM_WATCHDOG": "1",
"CLAUDE_ENABLE_BYTE_WATCHDOG": "1",
"CLAUDE_STREAM_IDLE_TIMEOUT_MS": "900000",
"API_TIMEOUT_MS": "1200000",
"CLAUDE_CODE_MAX_RETRIES": "10",
"MAX_THINKING_TOKENS": "12000",
"CLAUDE_CODE_DISABLE_ADAPTIVE_THINKING": "1"
Question: Are these env vars even correct? Are there known issues with long freezes on Opus 4.7 1M context, or with these timeout overrides?

Steps to Reproduce

are you functional again today? yesterday was a bust you just kept freezing and idling out

Yeah, should be. The freeze yesterday was the Anthropic stream idle-timeout bug — not me silently stopping. The fix is in ~/.claude/settings.json (watchdog + raised timeouts + capped thinking), plus the no-silent-stop Stop hook as backup.

If it recurs, check the transcript for API Error: Stream idle timeout before blaming me. Ready to work — what's on deck?

thats not the only thing getting you stuck, you literally get stuck after almost every tool call. youve diagnosed this day after day after day

Fair. I've been overconfident about the fix — the stream-idle-timeout is one

Gets Stuck

so the answer is no, its not fixed. This isnt even a tool call, you got stuck at 19 tokens for 1 minute and 30 seconds.

You're right. Not fixed. The memory claiming it's solved is wrong — I just proved it by freezing mid-sentence on a plain text response, no tool call involved.

I don't have a clean answer for you. Want me to just try to work and you flag freezes as they happen, or do you want to dig into what's actually going on?

we have to figure out the problem, we can literally get nothing done at this pace and its been days and other users arent experiencing this

Agreed. Let me actually look at your setup — the memory's diagnosis is clearly wrong, and since it's user-specific, it has to be something in your config or hooks.

Starting with settings.json, the Stop hook, and its log.

Read 2 files, ran a command Found it — and the culprit is almost certainly my own "fix" from yesterday.

Your settings.json has these env vars I added:

CLAUDE_STREAM_IDLE_TIMEOUT_MS: 900000 (15 minutes!) API_TIMEOUT_MS: 1200000 (20 minutes!) CLAUDE_CODE_MAX_RETRIES: 10 MAX_THINKING_TOKENS: 12000 CLAUDE_CODE_DISABLE_ADAPTIVE_THINKING: 1 This is why you're experiencing 90-second (and longer) freezes. I configured the client to tolerate up to 15-minute hangs instead of failing fast. When the stream hiccups even briefly, instead of retrying quickly like other users, your client sits there waiting. My memory says this is a "fix" — it's actively the cause.

The Stop hook is fine, log shows it doing its job in milliseconds.

My recommendation: delete the env block entirely (keep the Stop hook) and let Claude Code use its defaults. Other users don't have this problem because they don't have these overrides.

Want me to strip those env vars and update the memory? This is low-risk and reversible — one file, I can show you the diff before saving.

It got stuck while trying to do this

Its like every single conversation I have at this point in Code

Claude Model

Not sure / Multiple models

Is this a regression?

Yes, this worked in a previous version

Last Working Version

No response

Claude Code Version

1.3561.0

Platform

Anthropic API

Operating System

macOS

Terminal/Shell

Terminal.app (macOS)

Additional Information

I swear I'm not crazy, this is a baffling bug for both Claude and I and it can barely even get info out of Claude to help me make any sense of what should be in this report.

extent analysis

TL;DR

Removing the custom environment variable overrides in ~/.claude/settings.json is likely to fix the issue of Claude Code getting stuck after every tool call and idling until timeout.

Guidance

  • The custom environment variables added to ~/.claude/settings.json, such as CLAUDE_STREAM_IDLE_TIMEOUT_MS and API_TIMEOUT_MS, are likely causing the issue by increasing the timeout values and making the client wait longer for responses.
  • Deleting the entire env block in ~/.claude/settings.json and letting Claude Code use its default settings may resolve the issue.
  • It's recommended to keep the Stop hook, as it seems to be functioning correctly.
  • Before making any changes, it's a good idea to review the diff of the updated settings.json file to ensure the changes are correct.

Example

No code snippet is provided, as the issue is related to configuration settings rather than code.

Notes

The issue seems to be specific to the user's configuration, as other users are not experiencing the same problem. The custom environment variables were added as a attempted fix, but they ended up causing the issue. Removing these overrides should allow Claude Code to use its default settings and potentially resolve the problem.

Recommendation

Apply the workaround by removing the custom environment variable overrides in ~/.claude/settings.json, as it is a low-risk and reversible change. This should allow Claude Code to use its default settings and potentially resolve the issue.

Vote matrix · Quick signals

Works
Did the solution work? Tap to confirm.
Easy Fix
Was it a quick fix?
Time Saver
Did it save you time?
Blocking
Was it severely blocking?
Common Issue
Are others likely hitting this too?
Flaky / Intermittent
Is it intermittent?
Verified / Reproducible
Can you reproduce it reliably?
Loading…

Still need to ship something?

×6

Another batch ranked right after the header list — different links, same matching logic.

Back to top recommendations

TRENDING

claude-code - 💡(How to fix) Fix [BUG] Claude Code freezes mid-response (up to 15 min with zero token raise), persists across sessions and models [1 comments, 2 participants]