claude-code - 💡(How to fix) Fix [BUG] [Windows] Claude Code CLI hangs & VSCode extension errors "Query closed before response received" across all versions 2.1.98 / 2.1.112 / 2.1.114 since 2026-04-18 [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#50616Fetched 2026-04-19 15:15:11
View on GitHub
Comments
1
Participants
2
Timeline
6
Reactions
0
Timeline (top)
labeled ×5commented ×1

Starting 2026-04-18, Claude Code completely stopped working on a Windows 10 machine that had been using it successfully until 2026-04-17. After ~12 hours of extensive diagnostic work:

  • ❌ VSCode extension shows Error: Query closed before response received on every prompt
  • claude.exe -p "say hi" exits silently with exit code 0 and no output (Issue #7263 signature)
  • claude (interactive mode) hangs with no prompt, cannot accept input, must be killed with Ctrl+C (Issue #34526 signature)
  • Reproduced across 3 clean installs: 2.1.98, 2.1.112, 2.1.114 (VSIX installs + fresh npm installs)

Regression starts correlating with Claude Opus 4.7 GA release on 2026-04-16 and/or the managed-agents-2026-04-01 beta header introduction.


Error Message

[info] Spawning Claude with SDK query function - cwd: ..., version: 2.1.112, <path>\claude.exe, resume: undefined [info] From claude: [DEBUG] ... No git remote URL found ... (274ms later) ... [info] Closing Claude on channel: <id> [error] Error spawning Claude (on channel <id>): Error: Query closed before response received [error] Failed to load config cache: Error: Query closed before response received

Root Cause

Filed against version change

  • ❌ Rollback 2.1.114 → 2.1.112 manually (keeps residue)
  • ❌ Clean uninstall + fresh 2.1.112 install via VSIX
  • ❌ Clean uninstall + fresh 2.1.98 install via VSIX (expected bypass of Bun binary because 2.1.98 is Node.js-based)
  • ❌ Clean install latest 2.1.114 + npm CLI 2.1.114 simultaneously
  • ❌ Custom claudeCode.claudeProcessWrapper with .NET wrapper.exe invoking node cli.js (bypasses Bun stdin entirely) — still Query closed

Fix Action

Fix / Workaround

With a previous broken config (prior to NODE_EXTRA_CA_CERTS fix), these were followed by:

[DEBUG] Remote settings: Retry 1/5 after 538ms
[DEBUG] Policy limits: Retry 1/5 after 555ms
... (5 retries, ~17s total)

— those retries now succeed silently (after PEM workaround) but the outcome is identical: CLI stalls / exits.

Workarounds attempted (all ineffective)

  1. CLI init binary is healthy: produces correct output up to "No git remote URL found" identically across all versions. TLS works (after our PEM workaround).
  2. Something AFTER init blocks: Remote settings / Policy limits retry or stream-json stdin handshake fails silently.
  3. CLI interactive mode hangs without any feedback — input echo not shown, no error, no prompt. Consistent with broken stdin/stdout pipe OR early blocking RPC.
  4. Not a Bun-only issue: 2.1.98 is pure Node.js cli.js without bundled Bun native binary — also hangs. So this is either deeper (shared dependency, auth, or server-side behavior) or Node.js Windows stdin NamedPipe (Node.js issue #10836-class) actually bites both.
  5. Regression timing (2026-04-17 → 2026-04-18) is suspicious: Claude Opus 4.7 was released 2026-04-16 and managed-agents-2026-04-01 beta header was introduced around the same time per public changelogs. If CLI versions predating this required send different headers or the server now mandates something the client cache doesn't have, this could explain silent stall.

Code Example

npm install -g @anthropic-ai/claude-code
claude                           # HANGS forever, accepts no input
claude -p "say hi"               # exit 0, no output, no stderr
claude --debug -p "say hi"       # init logs written to %USERPROFILE%\.claude\debug\ but stops after "No git remote URL found"

---

[DEBUG] [init] configureGlobalAgents complete
[DEBUG] Using bash path: "C:\Program Files\Git\bin\bash.exe"
[DEBUG] Error log sink initialized
[DEBUG] Applying permission update: Adding 80 allow rule(s) ...
[DEBUG] Git remote URL: null
[DEBUG] No git remote URL found
← log terminates here; no further output ever written

---

[DEBUG] Remote settings: Retry 1/5 after 538ms
[DEBUG] Policy limits: Retry 1/5 after 555ms
... (5 retries, ~17s total)

---

[info] Spawning Claude with SDK query function - cwd: ..., version: 2.1.112,
       <path>\claude.exe, resume: undefined
[info] From claude: [DEBUG] ... No git remote URL found
... (274ms later) ...
[info] Closing Claude on channel: <id>
[error] Error spawning Claude (on channel <id>): Error: Query closed before response received
[error] Failed to load config cache: Error: Query closed before response received

---
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?

[Windows] Claude Code CLI hangs & VSCode extension errors "Query closed before response received" across all versions 2.1.98 / 2.1.112 / 2.1.114 since 2026-04-18

Summary

Starting 2026-04-18, Claude Code completely stopped working on a Windows 10 machine that had been using it successfully until 2026-04-17. After ~12 hours of extensive diagnostic work:

  • ❌ VSCode extension shows Error: Query closed before response received on every prompt
  • claude.exe -p "say hi" exits silently with exit code 0 and no output (Issue #7263 signature)
  • claude (interactive mode) hangs with no prompt, cannot accept input, must be killed with Ctrl+C (Issue #34526 signature)
  • Reproduced across 3 clean installs: 2.1.98, 2.1.112, 2.1.114 (VSIX installs + fresh npm installs)

Regression starts correlating with Claude Opus 4.7 GA release on 2026-04-16 and/or the managed-agents-2026-04-01 beta header introduction.


Environment

ItemValue
OSWindows 10 (Build 19045.6456)
Node.jsv22.20.0
npm10.9.3
VSCodelatest, Claude Code extension installed fresh from Marketplace AND VSIX
ShellPowerShell 5.1
Git BashC:\Program Files\Git\bin\bash.exe (detected by CLI init)
NetworkCorporate network behind MITM proxy (enterprise CA <corporate-CA> + Symantec Enterprise). WireGuard VPN "<vpn-tunnel>" to on-site fileserver `<corporate-fileserver-path>
SubscriptionClaude Max (individual)
OAuthValid, expiresAt in future, refresh token present

Reproduction

After clean uninstall (VSCode extension, npm global, globalStorage, settings), installing any version of Claude Code and running produces identical failure:

VSCode extension path

  1. Install Claude Code extension (any version 2.1.98 / 2.1.112 / 2.1.114)
  2. Open Claude Code panel
  3. Send any prompt (e.g. say hi)
  4. Error: Query closed before response received

CLI path

npm install -g @anthropic-ai/claude-code
claude                           # HANGS forever, accepts no input
claude -p "say hi"               # exit 0, no output, no stderr
claude --debug -p "say hi"       # init logs written to %USERPROFILE%\.claude\debug\ but stops after "No git remote URL found"

Debug log signature (common to all failures)

The CLI --debug run produces a debug log that consistently terminates right after Git remote detection:

[DEBUG] [init] configureGlobalAgents complete
[DEBUG] Using bash path: "C:\Program Files\Git\bin\bash.exe"
[DEBUG] Error log sink initialized
[DEBUG] Applying permission update: Adding 80 allow rule(s) ...
[DEBUG] Git remote URL: null
[DEBUG] No git remote URL found
← log terminates here; no further output ever written

With a previous broken config (prior to NODE_EXTRA_CA_CERTS fix), these were followed by:

[DEBUG] Remote settings: Retry 1/5 after 538ms
[DEBUG] Policy limits: Retry 1/5 after 555ms
... (5 retries, ~17s total)

— those retries now succeed silently (after PEM workaround) but the outcome is identical: CLI stalls / exits.

VSCode extension log signature

[info] Spawning Claude with SDK query function - cwd: ..., version: 2.1.112,
       <path>\claude.exe, resume: undefined
[info] From claude: [DEBUG] ... No git remote URL found
... (274ms later) ...
[info] Closing Claude on channel: <id>
[error] Error spawning Claude (on channel <id>): Error: Query closed before response received
[error] Failed to load config cache: Error: Query closed before response received

SDK side closes the stdio pipe ~274ms after CLI init output stops.


Workarounds attempted (all ineffective)

Filed against version change

  • ❌ Rollback 2.1.114 → 2.1.112 manually (keeps residue)
  • ❌ Clean uninstall + fresh 2.1.112 install via VSIX
  • ❌ Clean uninstall + fresh 2.1.98 install via VSIX (expected bypass of Bun binary because 2.1.98 is Node.js-based)
  • ❌ Clean install latest 2.1.114 + npm CLI 2.1.114 simultaneously
  • ❌ Custom claudeCode.claudeProcessWrapper with .NET wrapper.exe invoking node cli.js (bypasses Bun stdin entirely) — still Query closed

Environment hardening (all no-op to symptom)

  • ✅ TLS: NODE_EXTRA_CA_CERTS set to a PEM built from Windows root store (146 certs after dedupe + expiry filter); debug log now shows CA certs: Appended extra certificates from NODE_EXTRA_CA_CERTS — TLS handshake proceeds but stall persists
  • ❌ Windows Defender exclusions (.claude, native-binary folder, claude.exe process) — no change
  • ❌ Removed Mark-of-the-Web / Zone.Identifier — none present to begin with
  • ❌ Verified Hyper-V dynamic port range doesn't include MCP's chosen port
  • ❌ WireGuard VPN disconnected entirely — same failure
  • ❌ Claude Desktop app forcibly terminated (to eliminate .claude dir contention) — same failure
  • ide/*.lock cleanup — no change
  • ❌ Forced JSON auto-update check off (CLAUDE_CODE_SKIP_UPDATE_CHECK=1)

Observations that point toward root cause

  1. CLI init binary is healthy: produces correct output up to "No git remote URL found" identically across all versions. TLS works (after our PEM workaround).
  2. Something AFTER init blocks: Remote settings / Policy limits retry or stream-json stdin handshake fails silently.
  3. CLI interactive mode hangs without any feedback — input echo not shown, no error, no prompt. Consistent with broken stdin/stdout pipe OR early blocking RPC.
  4. Not a Bun-only issue: 2.1.98 is pure Node.js cli.js without bundled Bun native binary — also hangs. So this is either deeper (shared dependency, auth, or server-side behavior) or Node.js Windows stdin NamedPipe (Node.js issue #10836-class) actually bites both.
  5. Regression timing (2026-04-17 → 2026-04-18) is suspicious: Claude Opus 4.7 was released 2026-04-16 and managed-agents-2026-04-01 beta header was introduced around the same time per public changelogs. If CLI versions predating this required send different headers or the server now mandates something the client cache doesn't have, this could explain silent stall.

What we need from Anthropic

  1. Please check whether managed-agents-2026-04-01 or related header is being enforced server-side and whether 2.1.98 / 2.1.112 / 2.1.114 all send it properly on Windows builds.
  2. A way to obtain verbose stderr / network diagnostics from CLI post-init (currently silent — observable events stop at "No git remote URL found" in debug log, but CLI clearly makes further calls that fail).
  3. If this is a known Windows-specific regression, a timeline for fix. We have fallen back to WSL Ubuntu (which works) but would prefer native Windows.

Related issues

  • #7263 — -p silent exit (matches our CLI -p behavior exactly)
  • #34526 — Windows 10 MINGW64 silent exit (matches our claude interactive hang)
  • #39797 — Query closed before response received (matches our VSCode extension error)
  • #31209 — Windows Bun native binary STATUS_ACCESS_VIOLATION
  • #25464 — Claude Desktop × Claude Code VSCode extension interference (tested, not our cause)
  • #29373 — Session directory migration regression (unrelated but referenced during debug)

Attached diagnostics

Zipped diagnostics bundle (claude-code-diag-<timestamp>.zip) containing:

  • Full C:\Users\<user>\.claude\debug\*.txt from multiple reproduction attempts
  • VSCode extension logs from %APPDATA%\Code\logs\*\window*\exthost\Anthropic.claude-code\Claude VSCode.log
  • %APPDATA%\Code\logs\*\window*\exthost\exthost.log (Anthropic-related grep excerpts)
  • CLI version info (claude --version, claude doctor)
  • Sanitized OAuth metadata (expiry, subscription tier, scopes — no secrets)
  • PowerShell environment snapshot (relevant env vars, installed extensions, npm global list)
  • Screenshot of Query closed error in VSCode
  • Screenshot of hung claude interactive prompt

Timeline of investigation

  • 2026-04-17: Last known working day (2.1.112)
  • 2026-04-18 AM: Auto-update to 2.1.114, immediate failure
  • 2026-04-18 evening: Rollback to 2.1.112 manually — still failing
  • 2026-04-19 00:00 JST: Documented environment, filed v1 handover doc
  • 2026-04-19 01:00 JST: PEM-based TLS workaround eliminates Remote settings / Policy limits retry loops — but symptom persists after init completes
  • 2026-04-19 11:00-13:00 JST: Clean uninstall cycle → reinstall 2.1.114 / 2.1.112 / 2.1.98 → all fail identically → conclude environment-level problem that predates SDK/CLI version changes

Thank you for investigating. Happy to run any specific diagnostic commands on this machine to help triage.

What Should Happen?

Starting 2026-04-18, Claude Code completely stopped working on this Windows machine. Previously worked fine on 2026-04-17 with v2.1.112.

Symptoms (all reproduce with 100% consistency):

  1. VSCode extension: Every prompt fails with Error: Query closed before response received (~274ms after CLI spawn, right after CLI emits "No git remote URL found" in debug log)
  2. claude.exe -p "say hi" (CLI non-interactive): exits with code 0, produces no stdout, no stderr. Matches Issue #7263 signature.
  3. claude (CLI interactive mode): hangs forever with no prompt shown. Cannot accept input. Must Ctrl+C out. Matches Issue #34526 signature.

This has been confirmed across THREE clean, separate installs of Claude Code VSCode extension (2.1.114 from Marketplace, 2.1.112 from VSIX, 2.1.98 from VSIX), plus fresh npm CLI installations, plus the following extensive mitigations (none of which fixed the bug):

  • TLS/CA: resolved "Remote settings: Retry 5/5" and "Policy limits: Retry 5/5" loops via NODE_EXTRA_CA_CERTS pointing to PEM built from Windows root store (146 certs after dedup/expiry filter). TLS handshake now proceeds, but stall persists after init.
  • Complete uninstall cycle: VSCode extension + npm global + globalStorage + Zone.Identifier removed + Defender exclusions added
  • Claude Desktop app terminated (to eliminate .claude dir contention)
  • WireGuard VPN disconnected
  • Hyper-V dynamic port range verified clear
  • Custom claudeCode.claudeProcessWrapper with .NET exe invoking node + cli.js (bypasses bundled Bun binary) - still fails
  • Multiple hooks, permissions, credential validations

All three versions fail with identical debug log signature: initialization proceeds correctly through:

  • MDM settings load
  • configureGlobalMTLS / configureGlobalAgents (TLS works with our PEM workaround)
  • permission rule apply (80 rules)
  • "Git remote URL: null"
  • "No git remote URL found"

...then the debug log TERMINATES there. ~274ms later, VSCode extension reports "Closing Claude on channel: X" and "Error: Query closed before response received".

CLI is clearly alive and producing output up to init completion, then either (a) exits silently, or (b) hangs waiting on something that never arrives.

Error Messages/Logs

Steps to Reproduce

  1. Clean uninstall Claude Code extension + npm global claude-code + globalStorage Anthropic entries.
  2. Install Claude Code VSCode extension fresh (any version from 2.1.98 to 2.1.114, via Marketplace or VSIX).
  3. Also npm install -g @anthropic-ai/claude-code (version matches or latest).
  4. Open VSCode → Claude Code panel → type any prompt (e.g. "say hi") → send.
  5. Observe: Error: Query closed before response received.

CLI alternative:

  1. From PowerShell: claude -p "say hi" → exit 0, no output.
  2. Or: claude (interactive) → hangs, must Ctrl+C.

With --debug set (ANTHROPIC_LOG=debug), debug log in ~/.claude/debug/*.txt is created and contains correct init output up to "No git remote URL found", then terminates.

Claude Model

None

Is this a regression?

Yes, this worked in a previous version

Last Working Version

No response

Claude Code Version

2.1.98 (Claude Code)

Platform

Anthropic API

Operating System

Windows

Terminal/Shell

VS Code integrated terminal

Additional Information

claude-code-diag-sanitized-20260419_122025.zip

extent analysis

TL;DR

The issue is likely related to a regression introduced in the Claude Opus 4.7 release or the managed-agents-2026-04-01 beta header, causing the Claude Code CLI and VSCode extension to hang or exit silently on Windows.

Guidance

  1. Verify server-side changes: Check if the managed-agents-2026-04-01 header is being enforced server-side and if the client versions (2.1.98, 2.1.112, 2.1.114) send it properly.
  2. Obtain verbose diagnostics: Request a way to obtain verbose stderr/network diagnostics from the CLI post-init to help identify the cause of the silent stall.
  3. Test with previous versions: Attempt to use a version of Claude Code prior to the suspected regression (e.g., 2.1.97 or earlier) to confirm if the issue is indeed a regression.
  4. Check for environment-specific issues: Verify that the issue is not specific to the corporate network or MITM proxy by testing on a different network or with the proxy disabled.
  5. Review debug logs: Analyze the debug logs provided in the issue to see if there are any clues about what might be causing the stall or exit.

Example

No code snippet is provided as the issue seems to be related to a specific version or configuration of Claude Code, and without more information, it's difficult to provide a relevant example.

Notes

The issue seems to be specific to Windows and might be related to changes in the Claude Opus 4.7 release or the managed-agents-2026-04-01 beta header. The fact that the issue persists across different versions of Claude Code and with various workarounds suggests a deeper problem that may require changes to the server-side or the client configuration.

Recommendation

Apply a workaround by using a previous version of Claude Code that is known to work, if possible, until the root cause of the issue is identified and fixed.

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