Windows: Bash/PowerShell tool calls flash visible conhost window
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?
Description
Every time Claude Code executes a Bash or PowerShell tool call on Windows,
a conhost.exe window briefly flashes visibly on screen.
Root Cause (suspected)
bash.exe/powershell.exe spawned without CREATE_NO_WINDOW flag.
Suggested Fix
Pass CREATE_NO_WINDOW (0x08000000) when spawning shell processes on Windows.
Environment
- Windows 11, Claude Code 2.1.128+, Git Bash + PowerShell 5.1
What Should Happen?
Should not flash terminal window.
Error Messages/Logs
Steps to Reproduce
- Install Claude Code on Windows 11 with Git Bash (git-scm.com) installed
- Open Claude Desktop and start a new conversation
- Ask Claude to run any shell command, e.g.:
"List files in my home directory"
- Observe: a black console window (conhost.exe) briefly flashes
on screen and disappears
Verification
Run this in PowerShell to confirm conhost spawns from claude.exe:
Get-Process conhost | ForEach-Object {
$ppid = (Get-CimInstance Win32_Process -Filter "ProcessId=$($_.Id)").ParentProcessId
[PSCustomObject]@{ PID=$_.Id; Parent=(Get-Process -Id $ppid -EA SilentlyContinue).Name }
}
Expected output during a tool call:
PID Parent
----- ------
13064 claude
Notes
- Happens with both Bash tool and PowerShell tool
- Window is visible for ~100–300ms per tool call
- Does NOT happen with pythonw.exe-based processes (correct behavior)
- Reproducible on Claude Code 2.1.128 and 2.1.140
Claude Model
Opus
Is this a regression?
No, this never worked
Last Working Version
_No response_
Claude Code Version
Claude Code 2.1.128 and 2.1.140
Platform
Anthropic API
Operating System
Windows
Terminal/Shell
Windows Terminal
Additional Information
_No response_
7 Comments
Found 3 possible duplicate issues:
This issue will be automatically closed as a duplicate in 3 days.
🤖 Generated with Claude Code
Confirmed on Claude Desktop 1.7196.0.0 (Microsoft Store package) + Claude Code 2.1.138 on Windows 11. Adding process-trace evidence from a real session today.
Scope is broader than
bash.exe/powershell.exe— every console subprocess spawned byClaude.exeflashes:| Time | Process | Parent | Triggered by |
|------|---------|--------|--------------|
| every 5–15 s |
taskkill /pid N /T /F|claude.exe| background-task cleanup || burst of 9 simultaneously |
gh.exe pr view <branch> --json ...|claude.exe| PR-status check || as needed |
cmd.exe /d /s /c prisma generate|claude.exe→node.exe(pnpm) | npm-script execution || as needed |
cmd.exe /d /s /c node ./node_modules/vitest/vitest.mjs run ...| same | test runs || as needed |
git remote -v,tzutil,git-remote-https,sh.exe(credential-manager) | mixed | git internals |Captured by polling
Win32_Processat 250 ms intervals from a separatepwshwindow for 5 minutes. Each of these PIDs hasclaude.exe(C:\Program Files\WindowsApps\Claude_1.7196.0.0_x64__pzs8sxrjxfjjc\app\Claude.exe) in its ancestry, and each spawns a freshconhost.exethat flashes for ~100–300 ms.Frequency in practice: during normal use, flashes occur every 5–20 seconds. End-user perception was "every few minutes a terminal window flashes — it doesn't even open, just flashes" — they assumed scheduled-task or malware before tracing.
Suggested fix stands: pass
CREATE_NO_WINDOW(0x08000000) for everyCreateProcesscall from the Claude.exe host when the child is a console app. Alternatively,DETACHED_PROCESS(0x00000008) if no inherited handles are needed. Affects allBash/PowerShelltool calls and everynode/pnpm/gh/git/taskkillthey spawn transitively, because the missing flag propagates through defaultinheritHandles=true.Workaround for users hitting this: launch
claudefrom Windows Terminal directly — subprocesses inherit the existing console and stop flashing entirely.**Confirming on Claude Desktop (Cowork) + Claude Code, Windows 11 — and flagging that the focus theft, not just the flash, is the severe part.**
We hit this constantly across a team on Win11. Same root cause, two symptoms:
Root cause matches the report: shells spawned without
CREATE_NO_WINDOW(0x08000000). On Win11 with Windows Terminal as default, the console surfaces as aCASCADIA_HOSTING_WINDOW_CLASSwindow. Because it's a child of the foregroundClaude.exe, it can grab foreground even withForegroundLockTimeoutmaxed — so OS-level focus-steal mitigations don't help. The fix has to be at spawn time.Suggested fix: pass
CREATE_NO_WINDOWwhen spawning shell subprocesses on Windows; for the ConPTY path, create the pseudoconsole host hidden (STARTF_USESHOWWINDOW+SW_HIDE).Stopgap for anyone suffering now: an AutoHotkey v2 watcher using
SetWinEventHook(EVENT_SYSTEM_FOREGROUND)+ a fast sweep that hides console-class windows on appearance and bounces focus back. Tourniquet, not a cure — happy to share.High-impact for Windows users doing real agentic work. Would love to see the
CREATE_NO_WINDOWfix prioritized.Also reproduces on v2.1.178 (Windows 11), and it is not limited to Bash/PowerShell tool calls: every hook process Claude Code spawns (pwsh -File ...) flashes the same way, because none of these child processes are created with CREATE_NO_WINDOW. With several hooks configured the conhost windows steal keyboard focus while typing, so it is disruptive rather than just a flicker. Related: #61051. Fix is the CREATE_NO_WINDOW (0x08000000) flag on the child-process spawn.
Confirming this on a fresh environment, plus an extra data point and a feature suggestion.
Environment: Windows 11 Home, build 10.0.26200,
anthropic.claude-codev2.1.181-win32-x64 (VS Code native extension), both Git Bash and Windows PowerShell 5.1 tools.Extra confirmation method — Windows native process-creation auditing (Event ID 4688):
While debugging an unrelated recurring console flash on this same machine (turned out to be two unrelated background services, nothing to do with Claude Code), I enabled Process Creation auditing (
auditpol /set /subcategory:"{0CCE922B-69AE-11D9-BED3-505054503030}" /success:enable— must use the GUID, the localized subcategory name fails silently on non-English Windows) and read the Security log (Event ID 4688,Get-WinEvent, requires an elevated session or it silently returns empty). Correlating timestamps confirmed exactly what's described here: every Bash/PowerShell tool call from Claude Code spawnsbash.exe/powershell.exe→conhost.exewith noCREATE_NO_WINDOW/STARTF_USESHOWWINDOWflag, and that's reliably attributable down to the second once third-party causes are ruled out.This confirms the root cause described above is exactly right, and also gives a way for anyone else investigating "is this Claude or something else" to verify with certainty (4688 +
conhost.exe/cmd.exe/powershell.exeparent-child chain), since the UAC/elevation path is a separate question — these are all non-elevated tool calls.Feature suggestion on top of the fix: rather than just always hiding the window, it'd be useful to expose this as a setting with a few states, since some users actually want the visibility as an "agent is currently running a command" indicator (especially during long agentic sessions where they're not looking at the editor):
hidden(sensible default) —CREATE_NO_WINDOW, no window at all.visible— current behavior.visible-signed— visible but with a distinguishing window title/banner, so it's unambiguous that it's Claude Code and not some other process.Happy to share the full 4688 correlation data if useful for triage.
Confirming on Warp on Windows 11 with 12 concurrent claude.exe sessions — flash frequency scales with session count
Environment:
@anthropic-ai/claude-codenpm global)claude.exe --enable-auto-modesessions running in parallel Warp panesclaudeshimProcess trace:
Ran a 500ms-interval
Win32_Processpoller for 90 seconds and captured 106 short-lived process events. After filtering out my own polling and unrelated background sessions, the dominant pattern is:PID 27320 is the primary
claude.exesession in my setup. Each of the 12 claude.exe processes independently polls the primary session'sCreationDate.Tickson a roughly 1–3 second cadence, which looks like liveness/health tracking. That comes out to ~4–12 powershell spawns per second, each generating aconhost.exethat flashes for ~100–300ms.None of these child processes carry
-WindowStyle Hidden, and per the earlier comments the underlyingchild_process.spawncall site is missingwindowsHide: true.Multi-session scaling:
With N concurrent CLI sessions doing agentic work, the flash rate is roughly N × (Bash-tool-calls-per-second + liveness-polls-per-second). At N=12, keystroke loss becomes the primary UX symptom — characters typed into an editor often land in a conhost that flashes and disappears before Windows re-focuses. The visual flash is secondary.
Warp on Windows may not benefit from the Windows Terminal workaround.
The workaround floated in #66540 ("launch
claudefrom Windows Terminal so child processes inherit the console") relies onwt.exeproviding a proper attached conhost. Warp on Windows uses its own PTY implementation, and my 12claude.exeprocesses here still spawn fresh conhost windows despite being launched from Warp panes (not from Claude Desktop). I have not yet A/B tested againstwt.exedirectly — sharing as a data point in case Warp coverage matters for the fix design.On the fix:
Reiterating the shape already discussed:
windowsHide: trueonchild_process.spawncall sites (orCREATE_NO_WINDOWat the CreateProcess flag). Happy to gather additional traces or run an A/B test againstwt.exeif that would help triage.Adding another spawn-site data point that isn't yet listed above (MCP stdio / Bash tool / subagent spawning / Codex plugin): hook commands (
UserPromptSubmit,SessionEnd, etc. defined in.claude/settings.json) also trigger this.Each
"type": "command"hook entry is executed as a shell command (e.g.pnpm --dir "<path>" exec tsx scripts/foo.ts) on every matching event — for us, 3 hooks fire on everyUserPromptSubmitand 2 more on everySessionEnd. On Windows, under Claude Desktop (no inherited console), each of those fires its ownconhost.exe/cmd.exeflash, same root cause as described above (no console to inherit → new window per spawn). With several prompts/sessions in a day this alone produces bursts of 20-30 flashing windows, independent of any MCP servers or Bash tool usage.Confirms the fix needs to cover the hook-execution spawn path too, not just MCP/Bash/subagent/Codex spawn sites.