[BUG] Running `claude doctor` via Bash tool inside active session crashes Claude Code (Windows)
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?
Running claude doctor from within an active Claude Code session via the Bash tool (Bash(claude doctor 2>&1)) crashes the entire Claude Code process. The session terminates immediately with no error message or recovery option.
This is different from #37723 (Android/Termux raw mode issue). On Windows, claude doctor works fine when run from a separate terminal — it only crashes when invoked from within an active Claude Code session.
What Should Happen?
Either:
claude doctorshould work when called from within a session, or- Claude Code should detect this recursive invocation and return a helpful error message (e.g., "Cannot run
claude doctorfrom within an active session. Please run it from a separate terminal.")
Error Messages/Logs
No error message. The process terminates instantly. Exit is abrupt — no graceful shutdown, no log entry in ~/.claude/debug/<session-id>.txt for the crash itself.
Steps to Reproduce
- Start a Claude Code session on Windows 11 (
claudein terminal) - Ask Claude to run a diagnostic command
- Claude uses Bash tool:
claude doctor 2>&1 - Entire Claude Code session crashes immediately
- Terminal returns to prompt with no error output
Root Cause Hypothesis
Likely a conflict from spawning a new Claude Code process (which initializes Ink/terminal UI) inside the parent process that already owns the terminal. The child claude doctor may attempt to take over stdin/raw mode, conflicting with the parent's Ink renderer.
Workaround
Run claude doctor from a separate terminal window, never from within an active Claude Code session.
Claude Model
Opus 4.6
Is this a regression?
Unknown
Last Working Version
_No response_
Claude Code Version
2.1.114 (native)
Platform
Anthropic API
Operating System
Windows 11 Home 10.0.26200 (26H2)
Terminal/Shell
Git Bash (via Windows Terminal)
Additional Information
- CPU: i7-14700KF
- RAM: 64GB DDR5
- Related issue: #37723 (same command, different platform/root cause)
- The
claude --versionandclaude mcp listcommands also should not be run from within sessions for similar reasons
This issue has 3 comments on GitHub. Read the full discussion on GitHub ↗