Skip to content

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

Description

@grandcustomauto

Preflight Checklist

  • I have searched existing issues and this hasn't been reported yet
  • This is a single bug report (please file separate reports for different bugs)
  • 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

Metadata

Metadata

Assignees

No one assigned

    Labels

    duplicateThis issue or pull request already exists

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions