Interactive session turns hang intermittently on all models (Opus 4.8, Sonnet 4.6) — headless calls fast
Status Closed — duplicate
Reported on v2.1.156
Maintainer reply None cached
Activity 3 comments · opened May 28, 2026 · closed Jun 1, 2026
Summary
In an interactive Claude Code session, inference turns frequently hang (stall for 30s–several minutes, or indefinitely until interrupted) on all models tested, including claude-opus-4-8 and claude-sonnet-4-6. The same API path works fine from a headless claude -p call.
Environment
- Claude Code version: 2.1.156
- Node.js: v25.8.1
- OS: macOS Darwin 25.3.0, arm64 (Apple Silicon)
- Model(s) tested: claude-opus-4-8, claude-sonnet-4-6
- Context size: ~77k tokens (well under 1M limit)
Behaviour
- Interactive turns hang intermittently — sometimes for tens of seconds, sometimes until the user interrupts
- Occurs on both claude-opus-4-8 (newly rolled out) and claude-sonnet-4-6, ruling out a single-model issue
- Occurs in fresh sessions as well as long ones, ruling out context size
- Starting a new session does not resolve it
- The hang looks like waiting for first token (no output at all), not a slow stream
What works fine
Headless claude -p "reply OK" call in the same terminal:
- Opus 4.8: 200 in 1542ms, zero retries
- No overload, no 429/529 in debug logs
- Rate limits barely touched: 49/50 requests, 486k/500k input tokens remaining
Suspected cause
The interactive session sends a much larger set of beta headers than headless:
claude-code-20250219, context-1m-2025-08-07, interleaved-thinking-2025-05-14,
thinking-token-count-2026-05-13, context-management-2025-06-27,
prompt-caching-scope-2026-01-05, mid-conversation-system-2026-04-07,
advisor-tool-2026-03-01, advanced-tool-use-2025-11-24, effort-2025-11-24,
cache-diagnosis-2026-04-07
Headless uses a much smaller set. One of these beta flags may be triggering a slow/stalled server-side code path intermittently.
Debug output (working headless call for reference)
[log_ad9e50, request-id: "req_011CbVeji1QK5bZFDKXM3FsK"] post https://api.anthropic.com/v1/messages?beta=true succeeded with status 200 in 1542ms
anthropic-ratelimit-requests-remaining: 49
anthropic-ratelimit-input-tokens-remaining: 486000
Reproduction
- Open an interactive Claude Code session (
claudein terminal) - Ask any question that triggers an inference turn
- Observe: ~50% of turns hang with no output until interrupted
- Run
claude -p "reply OK"in a separate terminal — returns in ~1.5s
This issue has 3 comments on GitHub. Read the full discussion on GitHub ↗