[BUG] CLI hangs silently on WSL2 - streaming response never processed

Resolved 💬 4 comments Opened Mar 25, 2026 by dp-web4 Closed Apr 27, 2026

Description

Claude Code CLI hangs indefinitely on WSL2 when making any API call. No output, no error message. Affects interactive mode and claude -p.

Working on Mar 23 with v2.1.81 and same Windows install. Broke between Mar 23-25.

Environment

  • Windows 11 Pro 10.0.26200 / WSL2 Ubuntu
  • CLI versions tested: 2.1.80, 2.1.81, 2.1.83 — all hang
  • Auth: OAuth (Max subscription), token valid, auth status confirms logged in
  • Windows Updates: KB5085516 (Mar 22), KB5083532 (Mar 11) — ruled out since CLI worked Mar 23

What works vs what does not

| Environment | Status |
|---|---|
| Claude Desktop App (Windows) | Works |
| curl to api.anthropic.com from WSL2 | Works |
| Raw Node.js HTTPS with same token | Works (200) |
| CLI v1.0.124 on another WSL2 machine | Works (old scopes) |
| CLI v2.1.80/81/83 on WSL2 | Hangs |

Key findings

  1. API response arrives but CLI never processes it. ANTHROPIC_LOG=debug shows request sent, no response logged. strace confirms bytes received on socket. CLI sits in event loop forever.
  1. Raw Node.js proves API works. Same token, same headers, same endpoint — returns 200 instantly from WSL2.
  1. CLI silently swallows errors. When streaming endpoint returns 400/401, CLI hangs instead of showing error. This is the core UX bug.
  1. Server-side changes detected. Without oauth-2025-04-20 beta header, API returns "OAuth authentication is currently not supported." With it, Haiku works but Sonnet/Opus return 400 with generic "Error" message.
  1. OAuth scope difference. Working v1.0.124 uses scopes user:inference, user:profile. Broken v2.1.83 uses expanded scopes including user:file_upload, user:mcp_servers, user:sessions:claude_code.
  1. v2.1.81 worked Mar 23, hangs today — same binary, same Windows. Points to server-side change.

Repro

claude -p "say hello"  # hangs indefinitely
ANTHROPIC_LOG=debug claude -p "hi" 2>&1  # shows request, no response

Additional issues found

  • claude auth login redirect never completes on WSL2, no paste-code fallback
  • --bare flag reports "Not logged in" despite valid credentials
  • Cloudflare blocks manual OAuth token exchange from WSL2

Expected

Display error message and exit non-zero, not hang silently.

View original on GitHub ↗

This issue has 4 comments on GitHub. Read the full discussion on GitHub ↗