Skip to content

[BUG] Repeated Bun panic "switch on corrupt value" on Windows 11 x64 during long sessions (v2.1.50 / Bun 1.3.10) #27847

@waddock

Description

@waddock

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?

Description

Claude Code crashes with panic(main thread): switch on corrupt value during extended sessions. This has happened twice on the same machine, both times during sessions involving multiple subagent spawns (worktree orchestration with 5-7 parallel agents). The crash is non-deterministic — it occurs at different points in the session.

This appears related to #26763, #26590, #26531, #27086, and #27095. Filing separately to add another data point with full crash output and session context.

Environment

Detail Value
Claude Code version 2.1.50
Bun version 1.3.10 (1423d3c8)
OS Windows 11 Pro 10.0.26200 (x64)
CPU x64 baseline (sse42, avx, avx2)
RAM 33.78GB (reported by Bun — actual is 32GB)
Shell Git Bash

Session context at time of crash

Metric Value
Elapsed time ~37 minutes (2,255,367ms)
Peak RSS 1.56GB
Page faults 7,700,941
Session activity Orchestrating 5-7 parallel worktree agents via Task tool

Reproduction

Not deterministic, but both crashes shared these conditions:

  1. Windows 11 x64, Claude Code 2.1.50
  2. Session running 20-40 minutes
  3. Heavy use of Task tool with isolation: "worktree" spawning multiple parallel subagents (5-7 concurrent)
  4. Each subagent performing file reads, writes, git operations, and bash commands
  5. High I/O churn — creating branches, editing files across worktrees, running linters

The crash has not occurred during simpler sessions (single-agent, no worktrees, shorter duration).

Expected behaviour

Session should remain stable regardless of duration or number of subagents.

Actual behaviour

Bun panics with switch on corrupt value after ~20-40 minutes of heavy multi-agent use. All unsaved session state is lost. Work in progress across worktrees is left in an inconsistent state (some branches created, some not merged).

Impact

  • Session state is lost on crash (no auto-recovery)
  • Worktree branches may be left in partial states requiring manual cleanup
  • Forces users to limit session length and agent concurrency as a workaround
  • Particularly impacts orchestration workflows that rely on parallel agents

Notes

Potential Similar issues

What Should Happen?

Runs without any errors.

Error Messages/Logs

### Crash output
Bun v1.3.10 (1423d3c8) Windows x64 (baseline)
Windows v.win11_dt
CPU: sse42 avx avx2
Args: "claude"
Features: Bun.stderr(2) Bun.stdin(2) Bun.stdout(2) abort_signal(286) fetch(1250) jsc spawn(310) standalone_executable process_dlopen(2) yaml_parse(35)
Builtins: "bun:main" "node:assert" "node:async_hooks" "node:buffer" "node:child_process" "node:constants" "node:crypto" "node:events" "node:fs" "node:fs/promises" "node:http" "node:https" "node:module" "node:net" "node:os" "node:path" "node:path/posix" "node:path/win32" "node:perf_hooks" "node:process" "node:stream" "node:timers/promises" "node:tls" "node:tty" "node:url" "node:util" "node:zlib" "node:worker_threads" "undici" "ws"
Elapsed: 2255367ms | User: 223093ms | Sys: 53968ms
RSS: 0.84GB | Peak: 1.56GB | Commit: 1.77GB | Faults: 7700941 | Machine: 33.78GB
panic(main thread): switch on corrupt value
oh no: Bun has crashed. This indicates a bug in Bun, not your code.

Steps to Reproduce

Run Claude with worktree agents > 5 with run time longer than 30 mins.

Claude Model

Opus

Is this a regression?

Yes, this worked in a previous version

Last Working Version

No response

Claude Code Version

v2.1.50

Platform

Anthropic API

Operating System

Windows

Terminal/Shell

Windows Terminal

Additional Information

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions