[BUG] Claude Code terminates itself when asked to kill Node.js processes
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 asking Claude Code to kill all Node processes, it executes a command like ``taskkill //F //IM node.exe`` which terminates both the target development processes AND the Claude Code CLI itself, since the CLI runs on Node.js. This results in unexpected termination and complete loss of conversation context.
What Should Happen?
Claude should detect self-terminating commands and either:
- Refuse and suggest alternatives
- Warn and ask for confirmation
- Automatically exclude its own PID
- Target specific dev processes by name
Error Messages/Logs
Steps to Reproduce
- Start Claude Code CLI (``
claude``) - Start a Node-based development server (e.g., ``
npm run dev``) - Ask Claude: "kill all node processes for me"
- Claude executes ``
taskkill //F //IM node.exe`` (Windows) or similar command - The Claude Code CLI immediately terminates
Claude Model
Sonnet (default)
Is this a regression?
I don't know
Last Working Version
_No response_
Claude Code Version
2.0.22 (Claude Code)
Platform
Anthropic API
Operating System
Windows
Terminal/Shell
Other
Additional Information
Shell: Git Bash / MINGW64
First time it happened:
<img width="986" height="285" alt="Image" src="https://github.com/user-attachments/assets/8951e844-2d44-4011-a320-b517ea574227" />
When reproducing it:
<img width="983" height="484" alt="Image" src="https://github.com/user-attachments/assets/463ff223-c170-4413-a010-563e658e3788" />
This issue has 7 comments on GitHub. Read the full discussion on GitHub ↗