claude-code icon indicating copy to clipboard operation
claude-code copied to clipboard

Crash: EPERM error when killing background shell process

Open jhinrichsen opened this issue 3 days ago • 4 comments

Description

Claude Code crashed with an EPERM (permission error) when attempting to kill a background shell process.

Error Details

Error: kill EPERM
    at process.kill (node:internal/process/per_thread:281:13)
    at PM0 (file:///home/jot/.local/share/pnpm/global/5/.pnpm/@[email protected]/node_modules/@anthropic-ai/claude-code/cli.js:195:2928)
    at file:///home/jot/.local/share/pnpm/global/5/.pnpm/@[email protected]/node_modules/@anthropic-ai/claude-code/cli.js:195:2801
    at Array.forEach (<anonymous>)
    at file:///home/jot/.local/share/pnpm/global/5/.pnpm/@[email protected]/node_modules/@anthropic-ai/claude-code/cli.js:195:2772
    at Array.forEach (<anonymous>)
    at TM0 (file:///home/jot/.local/share/pnpm/global/5/.pnpm/@[email protected]/node_modules/@anthropic-ai/claude-code/cli.js:195:2744)
    at file:///home/jot/.local/share/pnpm/global/5/.pnpm/@[email protected]/node_modules/@anthropic-ai/claude-code/cli.js:195:2675

Context

The crash occurred after:

  1. Running a background bash command: sudo libinput debug-events --show-keycodes 2>&1 | head -50
  2. Attempting to kill the background shell using the Kill Shell tool

Environment

  • Claude Code version: 2.0.29
  • Platform: Linux (Fedora 43)
  • Kernel: 6.17.11-300.fc43.x86_64
  • Installation method: pnpm global

Steps to Reproduce

  1. Run a background bash command with sudo
  2. Attempt to kill the background shell process
  3. Observe EPERM error and crash

Expected Behavior

Claude Code should handle permission errors gracefully when attempting to kill background processes, rather than crashing.

jhinrichsen avatar Dec 24 '25 10:12 jhinrichsen