[BUG] [Windows] Bun panic "switch on corrupt value" crashes during Bash tool execution (v2.1.45 / Bun 1.3.10-canary.63)

Resolved 💬 6 comments Opened Feb 18, 2026 by plashal Closed Mar 2, 2026

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?

What's Wrong?

Claude Code crashes with a Bun runtime panic (switch on corrupt value) every time the Bash tool attempts to spawn a process. The crash is 100% reproducible across three separate sessions, affecting both the VS Code extension and the standalone CLI binary. The crash occurs at the exact same point in the execution flow: immediately after [DEBUG] Session environment not yet supported on Windows and before any Bash output is produced.

The crash occurred three times in two days with identical stack traces and the same crash report URL.

What Should Happen?

Expected Behavior

The Bash tool should spawn successfully and return command output.

Log Evidence

The last debug line before each crash is always:

[DEBUG] Session environment not yet supported on Windows

Followed immediately by the Bun crash dump. No Bash output is ever produced.

Confirmed Workaround

Switching from the native Bun binary to the npm-installed CLI eliminates the crash:

npm install -g @anthropic-ai/claude-code
Rename-Item "$env:USERPROFILE\.local\bin\claude.exe" "claude.exe.bak"

After this change, Get-Command claude resolves to the npm-installed version (Node.js-based), and Bash tool calls succeed without any panic.

Important: This workaround only fixes the CLI. The VS Code extension bundles its own Bun binary and still crashes. There is currently no workaround for the VS Code extension on Windows.

Error Messages/Logs

## Crash Details

All three crashes produce the same panic:


============================================================
Bun Canary v1.3.10-canary.63 (1979c945) Windows x64 (baseline)
Windows v.win11_dt
CPU: sse42 avx avx2

panic(main thread): switch on corrupt value
oh no: Bun has crashed. This indicates a bug in Bun, not your code.


**Crash report URL:** https://bun.report/1.3.10/e_21979c94mgggEuhogC09gkQ4p4vbq705Vwws1U23wN284hUm5nlOiq4kOwkzjwDCYKERNEL32.DLLut0LCSntdll.dll4gijBA0eNorLs8sSc5QyM9TSM4vKiotKFEoS8wpTQUAa8EI/A

Steps to Reproduce

Reproduction Steps

  1. Install Claude Code extension v2.1.45 on Windows 11
  2. Open a project on a non-C: drive (e.g., G: drive mapped via MSYS/Git Bash)
  3. Start a conversation that requires Bash tool execution
  4. Claude attempts to spawn a Bash process
  5. Bun panics with "switch on corrupt value" before any Bash output is produced

The crash is nondeterministic in timing (occurs after 3 minutes or 3 hours) but deterministic in trigger (always during Bash spawn). Crash 2 proves it is not a memory accumulation issue since it occurred with only 0.82GB commit after 3 minutes.

Crash 1: VS Code extension, long session

  • Source: VS Code extension (v2.1.45)
  • Session duration: ~3.3 hours (Elapsed: 11,871,770ms)
  • Memory at crash: RSS 0.55GB, Peak 0.67GB, Commit 1.21GB, Faults 2,187,509
  • Trigger: Bash tool call during a multi-phase project scaffolding task
  • Exit code: 3

Crash 2: VS Code extension, short session

  • Source: VS Code extension (v2.1.45)
  • Session duration: ~3.4 minutes (Elapsed: 204,280ms)
  • Memory at crash: RSS 0.54GB, Peak 0.59GB, Commit 0.82GB, Faults 314,573
  • Trigger: First Bash tool call after resuming work in a new session
  • Exit code: 3
  • CWD: Non-C: drive, path containing spaces

Crash 3: CLI binary

  • Source: Native CLI binary with --dangerously-skip-permissions
  • Memory at crash: RSS 0.64GB, Peak 0.69GB, Commit 0.85GB, Faults 439,657
  • Elapsed: 151,115ms
  • Trigger: Bash tool call (spawn)

Claude Model

Opus

Is this a regression?

Yes, this worked in a previous version

Last Working Version

v2.1.45

Claude Code Version

v2.1.45

Platform

Anthropic API

Operating System

Windows

Terminal/Shell

PowerShell

Additional Information

Environment

  • OS: Windows 11 (win11_dt)
  • CPU: x64 (baseline), sse42 avx avx2
  • Machine RAM: 34.27GB
  • Claude Code VS Code Extension: v2.1.45
  • Claude Code CLI: v2.1.45 (native binary)
  • Bundled Bun: Canary v1.3.10-canary.63 (1979c945)
  • Bash: Git for Windows (bash.exe)
  • Shell: Git Bash / MSYS2

Additional Context

  • The project working directory is on a non-C: drive, which is known to cause issues with the Bash sandbox
  • The CWD in Crash 2 contained spaces, though Crash 1 did not
  • Startup logs show repeated [ERROR] ENOENT: no such file or directory, open '<user-home>\.claude\remote-settings.json' errors (4x at startup), though these appear non-fatal
  • The npm-installed version displays a yellow banner: "Claude Code has switched from npm to native installer." This warning should be suppressed or reworded when the native installer is the one crashing.
  • Related issues: #9169, #9217, #9261, #11201, #19439, #19666 (all Windows Bun panics across different Bun versions from 1.2.23 through 1.3.10-canary)

View original on GitHub ↗

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