[BUG] Bug Report: Claude Code crashes with "Error: kill EPERM"
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:
- Background processes/agents accumulating over the session
- Process ownership or permissions changing during long-running sessions
- Stale process handles or zombie processes
- 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_
This issue has 3 comments on GitHub. Read the full discussion on GitHub ↗