claude-code - 💡(How to fix) Fix [BUG] Visible console windows pop up for every bash command on Windows (Git Bash) — missing windowsHide flag

Official PRs (…)
ON THIS PAGE

Recommended Tools

×6

Utilities matched from this issue’s tags and category — try them while you read without losing context.

GitHub issue graph ai analysis

Paste a GitHub issue URL. We fetch that issue, discover linked issues from bodies/comments/timeline, collect linked pull requests, and produce a structured English report.

The report is written in English Markdown for sharing and archival.

Helpful · Quick feedback

Loading…

Error Message

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:

Root Cause

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.

Code Example

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)
RAW_BUFFERClick to expand / collapse

Preflight Checklist

  • I have searched existing issues and this hasn't been reported yet
  • This is a single bug report (please file separate reports for different bugs)
  • 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.

Vote matrix · Quick signals

Works
Did the solution work? Tap to confirm.
Easy Fix
Was it a quick fix?
Time Saver
Did it save you time?
Blocking
Was it severely blocking?
Common Issue
Are others likely hitting this too?
Flaky / Intermittent
Is it intermittent?
Verified / Reproducible
Can you reproduce it reliably?
Loading…

Still need to ship something?

×6

Another batch ranked right after the header list — different links, same matching logic.

Back to top recommendations

TRENDING

claude-code - 💡(How to fix) Fix [BUG] Visible console windows pop up for every bash command on Windows (Git Bash) — missing windowsHide flag