[BUG] Claude crashes its own session when using broad process killers (taskkill //IM node.exe, pkill node)

Resolved 💬 2 comments Opened Dec 14, 2025 by Spacehunterz Closed Dec 14, 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?

When asked to restart a dev server or kill a stuck process, Claude sometimes uses broad process killers like taskkill //IM node.exe (Windows) or pkill node (Unix). This kills ALL Node.js processes on the system, including Claude Code's own infrastructure (MCP servers, file watchers, etc.), causing the session to crash.

What Should Happen?

Claude should kill only the specific process, not all Node processes:

# Windows - find specific PID
netstat -ano | findstr :3001
# Then kill only that PID
taskkill //F //PID <specific-pid>

# Unix - find specific PID
lsof -i :3001
# Then kill only that PID
kill <specific-pid>

Add guardrails to prevent Claude from using broad process killers for shared runtimes:

  1. Block patterns: taskkill //IM node.exe, pkill node, killall node, pkill python, etc.
  2. Suggest alternatives: When Claude wants to kill a process, guide it to find the specific PID first
  3. Documentation: Add to Claude Code docs that broad process killing is dangerous

Error Messages/Logs

Steps to Reproduce

  1. Start a Claude Code session
  2. Have a Node.js dev server running (e.g., Vite on port 3001)
  3. Ask Claude to restart the dev server due to a problem (e.g., "the server is serving corrupted content, restart it")
  4. Claude may execute: taskkill //F //IM node.exe or similar
  5. Session crashes immediately

Claude Model

Opus

Is this a regression?

I don't know

Last Working Version

_No response_

Claude Code Version

2.0.69

Platform

Anthropic API

Operating System

Windows

Terminal/Shell

PowerShell

Additional Information

This is a fundamental issue because Claude Code itself runs on Node.js. Any "kill all node" command is effectively a self-destruct. The same principle applies to other shared runtimes (Python, Ruby, etc.) if Claude Code uses them for MCP servers or other infrastructure.

View original on GitHub ↗

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