[BUG]

Resolved 💬 1 comment Opened Jun 16, 2025 by VanL Closed Jun 17, 2025

Environment

  • Platform (select one):
  • [ ] Anthropic API
  • [ ] AWS Bedrock
  • [ ] Google Vertex AI
  • [x] Other: Local dev
  • Claude CLI version: C
  • Operating System: macOS 15
  • Terminal: iTerm2

Bug Description

If Claude code has made a tool call and it is waiting on the result, and I hit escape, Claude crashes with a 1000+-deep stacktrace that looks like this:

Error: spawn EBADF
at ChildProcess.spawn (node:internal/child_process:421:11)
at spawn (node:child_process:753:9)
at file:///opt/bun/install/global/node_modules/@anthropic-ai/claude-code/cli.js:138:160626
at ck1 (file:///opt/bun/install/global/node_modules/@anthropic-ai/claude-code/cli.js:138:161121)
at file:///opt/bun/install/global/node_modules/@anthropic-ai/claude-code/cli.js:138:161354
at Array.forEach (<anonymous>)
at ChildProcess.Y (file:///opt/bun/install/global/node_modules/@anthropic-ai/claude-code/cli.js:138:161289)
at ChildProcess.emit (node:events:507:28)
at ChildProcess.emit (node:domain:489:12)
at maybeClose (node:internal/child_process:1101:16) {
errno: -9,
code: 'EBADF',
syscall: 'spawn'
}
Error: spawn EBADF
at ChildProcess.spawn (node:internal/child_process:421:11)
at spawn (node:child_process:753:9)
at file:///opt/bun/install/global/node_modules/@anthropic-ai/claude-code/cli.js:138:160626
at ck1 (file:///opt/bun/install/global/node_modules/@anthropic-ai/claude-code/cli.js:138:161121)
at file:///opt/bun/install/global/node_modules/@anthropic-ai/claude-code/cli.js:138:161354
at Array.forEach (<anonymous>)
at ChildProcess.Y (file:///opt/bun/install/global/node_modules/@anthropic-ai/claude-code/cli.js:138:161289)
at ChildProcess.emit (node:events:507:28)
at ChildProcess.emit (node:domain:489:12)
at maybeClose (node:internal/child_process:1101:16) {
errno: -9,
code: 'EBADF',
syscall: 'spawn'
}

This doesn't happen on Anthropic API calls, only local tool calls.

Steps to Reproduce

  1. Start claude
  2. Ask it to run something on the local machine that takes a little bit ("sleep 10")
  3. Hit escape while it is running

Expected Behavior

It says "User canceled call (call still occurring in background)" or something like that

Actual Behavior

It appears to return, but within a couple seconds it gives the spawn error (with a couple times briefly showing the input box) and then exits.

Additional Context

I think I am using node for claude alone, but but might be using bun.

View original on GitHub ↗

This issue has 1 comment on GitHub. Read the full discussion on GitHub ↗