[Bug] Error: kill EPERM - Permission denied when trying to kill process on Linux
Bug Report
Description
Claude Code is throwing an EPERM (permission denied) error when attempting to kill a process on Linux. The error occurs in the process management code.
Error Details
Error: kill EPERM
at process.kill (node:internal/process/per_thread:281:13)
at VNA (file:///home/rodrigo/.claude/local/node_modules/@anthropic-ai/claude-code/cli.js:165:3109)
at file:///home/rodrigo/.claude/local/node_modules/@anthropic-ai/claude-code/cli.js:165:2982
at Array.forEach (<anonymous>)
at file:///home/rodrigo/.claude/local/node_modules/@anthropic-ai/claude-code/cli.js:165:2953
at Array.forEach (<anonymous>)
at FNA (file:///home/rodrigo/.claude/local/node_modules/@anthropic-ai/claude-code/cli.js:165:2925)
at file:///home/rodrigo/.claude/local/node_modules/@anthropic-ai/claude-code/cli.js:165:2856
at ChildProcess.W (file:///home/rodrigo/.claude/local/node_modules/@anthropic-ai/claude-code/cli.js:165:3341)
at ChildProcess.emit (node:events:519:28) {
errno: -1,
code: 'EPERM',
syscall: 'kill'
}
Node.js v22.19.0
Environment
- OS: Linux (Ubuntu - based on kernel 6.14.0-29-generic)
- Node.js Version: v22.19.0
- Claude Code Location:
/home/rodrigo/.claude/local/node_modules/@anthropic-ai/claude-code/ - User: rodrigo
Additional Context
The error appears to be happening in the minified code at cli.js:165 in the function VNA which tries to execute process.kill(). This seems to be related to process management and cleanup operations.
The specific line causing the issue:
at VNA (file:///home/rodrigo/.claude/local/node_modules/@anthropic-ai/claude-code/cli.js:165:3109)
This appears to be a permissions issue where Claude Code doesn't have the necessary permissions to kill certain processes on Linux systems.
Possible Solutions
- Check if the process being killed belongs to a different user
- Add proper error handling for EPERM errors
- Consider using alternative methods for process cleanup on Linux
- Document any required permissions or configurations for Linux users
Steps to Reproduce
Unfortunately, the exact steps to reproduce are not clear from the error log, but it appears to happen during normal Claude Code operations involving process management.
Impact
This error may prevent Claude Code from properly cleaning up child processes or managing system resources on Linux systems.
This issue has 3 comments on GitHub. Read the full discussion on GitHub ↗