[BUG] Visible console windows pop up for every bash command on Windows (Git Bash) — missing windowsHide flag

Resolved 💬 2 comments Opened May 31, 2026 by ShaKQl Closed Jun 3, 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?

<img width="996" height="703" alt="Image" src="https://github.com/user-attachments/assets/b03aa2a4-47ce-4153-977c-94b266514768" />

On Windows with Git Bash installed, Claude Code spawns a new visible console window (conhost.exe) for every bash-related operation. This includes:

Shell snapshot creation — at session start, Claude Code runs bash --login -i -c "declare -p; declare -f; ..." to capture the user's full environment. Each snapshot spawn creates a visible window.
Hook script execution — any plugin hooks using "shell": "bash" spawn additional windows per event (PostToolUse, UserPromptSubmit, Stop, etc.)
The windows stack up and steal focus constantly, making Claude Code unusable on Windows without significant workflow interruption. This issue exists before any plugins are installed — it is caused by the shell snapshot mechanism itself.

The root cause: Claude Code's shell snapshot and hook executor code paths call child_process.spawn() without windowsHide: true. On Windows, this causes every console-mode child process (like bash.exe) to receive its own visible conhost.exe window. Notably, Claude Code's own Bash tool execution does not exhibit this problem, suggesting that code path already uses windowsHide: true but the snapshot/hook paths do not.

What Should Happen?

All background bash invocations (shell snapshot creation, hook execution) should run silently with no visible window, identical to how Claude Code's own Bash tool runs today.

Error Messages/Logs

No error messages — the windows appear and disappear (or linger) but produce no logged errors. The title bar of the spurious windows reads:

/usr/bin/bash --login -i -c "${CLAUDE_PLUGIN_ROOT}/hooks/run-hook.cmd" ...
(/usr/bin/bash is the MSYS2/Git Bash self-path for D:\install\Git\usr\bin\bash.exe)

Steps to Reproduce

Install Git for Windows (e.g. to D:\install\Git) so that bash resolves to Git Bash on PATH
Install Claude Code 2.1.156 on Windows
Open any project and start a Claude Code session
Immediately (before any prompt), observe 1–2 console windows flash open and close — these are shell snapshot creations
Submit any prompt or trigger any tool use — observe additional windows per operation
Install any plugin that uses "shell": "bash" hooks (e.g. claude-mem) — windows now appear on every tool call (PostToolUse fires after each tool)
Evidence of the snapshot mechanism: Check ~/.claude/shell-snapshots/ — each .sh file there represents one bash --login -i spawn that created a window.

Claude Model

Not sure / Multiple models

Is this a regression?

I don't know

Last Working Version

_No response_

Claude Code Version

2.1.156

Platform

Anthropic API

Operating System

Windows

Terminal/Shell

PowerShell

Additional Information

The settings.json has shellPath pointing to PowerShell — yet Claude Code still uses Git Bash (bash --login -i) for its internal shell snapshot system, ignoring the configured shell for this code path
The snapshot files contain a mixed Windows + MSYS2 PATH (e.g. C:\Python313:/c/Users/ASUS/...), which is how Claude Code knows to use Git Bash — it detected it on PATH and uses it to capture the full user environment
Suggested fix: Pass windowsHide: true to child_process.spawn() (or equivalent) in both the shell snapshot creation code path and the hook executor code path on Windows. This is the same Node.js flag that already silences the Bash tool's own execution.

View original on GitHub ↗

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