[BUG] Claude Code crashes after terminating spawned process

Resolved 💬 8 comments Opened Aug 12, 2025 by andrewyager Closed Jan 9, 2026

Environment

  • Platform (select one):
  • [X] Anthropic API
  • [ ] AWS Bedrock
  • [ ] Google Vertex AI
  • [ ] Other: <!-- specify -->
  • Claude CLI version: 1.0.73
  • Operating System: macOS 15.6 (24G84)
  • Terminal: Terminal App

Bug Description

When running commands that timeout, or are backgrounded that end either because Claude Code kills them, or otherwise, Claude Code crashes with a spawn error.

⏺ The script has been running for over 2 minutes, which is quite long. It seems to be stuck loading the large Excel file. Let me kill
  this process and create a more efficient version that shows better progress:

⏺ Kill Bash(Kill shell: bash_5)
  ⎿  Shell bash_5 killed


node:internal/child_process:421
    throw new ErrnoException(err, 'spawn');
    ^

Error: spawn EBADF
    at ChildProcess.spawn (node:internal/child_process:421:11)
    at spawn (node:child_process:763:9)
    at file:///opt/homebrew/lib/node_modules/@anthropic-ai/claude-code/cli.js:558:19411
    at V$0 (file:///opt/homebrew/lib/node_modules/@anthropic-ai/claude-code/cli.js:558:19906)
    at file:///opt/homebrew/lib/node_modules/@anthropic-ai/claude-code/cli.js:558:20139
    at Array.forEach (<anonymous>)
    at ChildProcess.I (file:///opt/homebrew/lib/node_modules/@anthropic-ai/claude-code/cli.js:558:20074)
    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'
}

Steps to Reproduce

  1. Start a long running process
  2. Background it (easiest way to reproduce)
  3. Ask Claude Code to kill it

Expected Behavior

Claude to kill the process and it to continue

Actual Behavior

Crash

Additional Context

View original on GitHub ↗

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