[BUG] Running `claude doctor` via Bash tool inside active session crashes Claude Code (Windows)

Resolved 💬 3 comments Opened Apr 19, 2026 by cookiedoeinc Closed Apr 23, 2026

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:

  1. claude doctor should work when called from within a session, or
  2. Claude Code should detect this recursive invocation and return a helpful error message (e.g., "Cannot run claude doctor from 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

  1. Start a Claude Code session on Windows 11 (claude in terminal)
  2. Ask Claude to run a diagnostic command
  3. Claude uses Bash tool: claude doctor 2>&1
  4. Entire Claude Code session crashes immediately
  5. 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 --version and claude mcp list commands also should not be run from within sessions for similar reasons

View original on GitHub ↗

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