[Bug] Claude Code CLI Crash When Killing Timed-Out Sudo Processes - EPERM Error

Resolved 💬 3 comments Opened Aug 25, 2025 by osman20OA Closed Aug 29, 2025

Labels: bug, area:core, has repro

Environment:

  • OS: Arch Linux
  • Shell: Fish
  • Command: sudo pacman -Syu linux-firmware

Description:

Claude Code CLI crashes with an unhandled exception when attempting to kill a timed-out sudo
process due to insufficient permissions.

Root Cause:

  1. CLI executes sudo pacman -Syu linux-firmware as child process
  2. Command times out after 2 minutes
  3. CLI attempts to kill the process, but it's now owned by root
  4. User-level process cannot kill root-owned process → EPERM error
  5. Unhandled exception crashes the CLI

Expected Behavior:
CLI should gracefully handle timeout of sudo commands without crashing.

Suggested Fix:

  • Detect sudo commands before execution
  • Use process group termination for sudo processes
  • Handle EPERM errors gracefully when killing processes
  • Warn users about potential timeout issues with sudo commands

Stack Trace:
Error: kill EPERM
at process.kill (node:internal/process...)

Impact:
CLI becomes unusable and any ongoing work is lost when sudo commands timeout.

View original on GitHub ↗

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