claude-code icon indicating copy to clipboard operation
claude-code copied to clipboard

[Bug] Error: kill EPERM - Permission denied when trying to kill process on Linux

Open rodrigolima1910 opened this issue 1 year ago • 3 comments

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

  1. Check if the process being killed belongs to a different user
  2. Add proper error handling for EPERM errors
  3. Consider using alternative methods for process cleanup on Linux
  4. 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.

rodrigolima1910 avatar Sep 12 '25 17:09 rodrigolima1910

Found 1 possible duplicate issue:

  1. https://github.com/anthropics/claude-code/issues/2362

This issue will be automatically closed as a duplicate in 3 days.

  • If your issue is a duplicate, please close it and 👍 the existing issue instead
  • To prevent auto-closure, add a comment or 👎 this comment

🤖 Generated with Claude Code

github-actions[bot] avatar Sep 12 '25 17:09 github-actions[bot]

This issue has been automatically closed as a duplicate of #2362.

If this is incorrect, please re-open this issue or create a new one.

🤖 Generated with Claude Code

github-actions[bot] avatar Sep 16 '25 09:09 github-actions[bot]

This issue has been automatically locked since it was closed and has not had any activity for 7 days. If you're experiencing a similar issue, please file a new issue and reference this one if it's relevant.

github-actions[bot] avatar Sep 23 '25 14:09 github-actions[bot]