[BUG] Bug Report: Claude Code crashes with "Error: kill EPERM"

Resolved 💬 3 comments Opened Dec 24, 2025 by grandcustomauto Closed Dec 27, 2025

Preflight Checklist

  • [x] I have searched existing issues and this hasn't been reported yet
  • [x] This is a single bug report (please file separate reports for different bugs)
  • [x] I am using the latest version of Claude Code

What's Wrong?

Description

Claude Code is crashing with an EPERM (permission error) when attempting to terminate background processes. This appears to happen during process cleanup operations.

Frequency

Happens intermittently after extended use. Does not occur at the start of a session.

Possible Triggers

  • Occurs after Claude Code has been processing for a while (long chat sessions)
  • Does not happen immediately upon starting Claude Code
  • Appears to be related to accumulated background processes or agents from extended session usage

Additional Context

The error occurs in the process cleanup logic and suggests a resource management issue that develops over time. This may indicate:

  1. Background processes/agents accumulating over the session
  2. Process ownership or permissions changing during long-running sessions
  3. Stale process handles or zombie processes
  4. Memory or resource exhaustion leading to permission issues

The timing (only after extended use) suggests this may be a resource leak or process lifecycle management bug rather than a simple permission configuration issue.

What Should Happen?

Expected Behavior

Claude Code should gracefully clean up background processes without permission errors, even during long-running sessions.

Actual Behavior

Claude Code crashes with an EPERM error when attempting to kill processes, suggesting it lacks permissions to terminate processes it created.

Error Messages/Logs

Error Message

  Error: kill EPERM
      at process.kill (node:internal/process/per_thread:277:13)
      at SYB (file:///home/user/.nvm/versions/node/v25.2.1/lib/node_modules/@anthropic-ai/claude-code/cli.js:240:46222)
      at file:///home/user/.nvm/versions/node/v25.2.1/lib/node_modules/@anthropic-ai/claude-code/cli.js:240:46095
      at Array.forEach (<anonymous>)
      at file:///home/user/.nvm/versions/node/v25.2.1/lib/node_modules/@anthropic-ai/claude-code/cli.js:240:46066
      at Array.forEach (<anonymous>)
      at PYB (file:///home/user/.nvm/versions/node/v25.2.1/lib/node_modules/@anthropic-ai/claude-code/cli.js:240:46038)
      at file:///home/user/.nvm/versions/node/v25.2.1/lib/node_modules/@anthropic-

  Environment

  - OS: Linux 6.14.0-36-generic
  - Node.js Version: v25.2.1
  - Package Manager: nvm
  - Claude Code Installation: Global npm installation

Steps to Reproduce

.

Claude Model

None

Is this a regression?

Yes, this worked in a previous version

Last Working Version

_No response_

Claude Code Version

2.0.76

Platform

Anthropic API

Operating System

Ubuntu/Debian Linux

Terminal/Shell

Terminal.app (macOS)

Additional Information

_No response_

View original on GitHub ↗

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