[BUG] Console window briefly flashes on every shell command execution (Windows)

Open 💬 0 comments Opened Jul 3, 2026 by ZhangYu0103

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?

Environment

  • OS: Windows 11 Pro, build 10.0.26200
  • Claude Code version: 2.1.195
  • Shell tools affected: both the Bash tool (Git Bash) and the PowerShell tool

Description

A console window briefly flashes and disappears on the desktop nearly every
time Claude Code executes a shell command, regardless of which tool
(Bash or PowerShell) is used.

Steps to Reproduce

  1. Start a Claude Code session on Windows.
  2. Ask Claude to run a trivial command via the Bash tool (e.g. echo hello

or grep). Observe a console window flash briefly and disappear.

  1. Ask Claude to run a trivial command via the PowerShell tool (e.g.

Write-Output "test"). The same flash occurs.

Expected Behavior

No visible window should appear when a tool-invoked shell command runs —
output should only surface in the Claude Code transcript/UI.

Actual Behavior

A console window flashes and disappears almost instantly for nearly every
tool-invoked shell command.

Diagnostic Steps Already Taken (ruling out project-specific causes)

  • Added creationflags=subprocess.CREATE_NO_WINDOW to every

subprocess.run() call in a Python script the session had been using
(which itself launched a third-party console EXE). This reduced flash
frequency but did NOT eliminate it.

  • Confirmed the flash still occurs on a bare Bash tool call containing only

grep/echo — no Python or external processes invoked at all.

  • Confirmed the flash still occurs on a bare PowerShell tool call containing

only Write-Output + Get-Date — no external processes invoked.

  • This rules out: the specific third-party software being used, the user's

own scripts, and anything Git-Bash-specific (since PowerShell shows the
identical symptom). The common factor across both tools is the Claude Code
client's own mechanism for spawning a shell process on Windows.

Suspected Root Cause (for maintainers to verify)

On Windows, spawning a console-subsystem child process from a host process
that has no attached console causes Windows to allocate a fresh
conhost.exe window, which becomes briefly visible before auto-closing when
the (often very short) command completes. This is typically avoided by
passing windowsHide: true (Node.js child_process option) or the
CREATE_NO_WINDOW process-creation flag when spawning the shell process.

Impact

Cosmetic only — does not affect command output or correctness — but is a
repeated visual distraction during sessions with heavy tool/command usage.

What Should Happen?

No console window should appear or flash on screen when Claude Code executes a shell command through the Bash or PowerShell tool. Command output should only appear in the Claude Code transcript/UI — the command should run invisibly in the background, since it's a tool-invoked action, not something the user is directly interacting with in a terminal.

Error Messages/Logs

No error messages or dialogs appear — the window flashes and disappears silently with no visible text, error output, or log entry. Nothing was captured in the Claude Code transcript/tool output either; the flash is a pure visual artifact with no associated error message.

Steps to Reproduce

  1. On a Windows machine (tested on Windows 11 Pro, build 10.0.26200), start a Claude Code session (via the Agent SDK / embedded client).
  2. Ask Claude to execute a trivial command using the Bash tool, e.g.:

echo hello

  1. Watch the desktop while the command runs. A console window briefly appears and disappears (flashes) on screen.
  2. Ask Claude to execute a trivial command using the PowerShell tool instead, e.g.:

Write-Output "test"

  1. The same brief window flash is observed again, with a different shell tool.

Notes:

  • No special files, project setup, or third-party software are required — the flash occurs on the simplest possible commands (a single echo / Write-Output), so steps 2-3 alone are sufficient to reproduce it.
  • The flash occurs on effectively every shell command invocation, not just specific ones — steps 4-5 are included only to show the behavior is not specific to one particular shell tool (Bash vs PowerShell), ruling out a Git-Bash-only cause.
  • This was diagnosed during a longer working session; the flash was observed consistently across dozens of separate command invocations, not as a one-off.

Claude Model

Sonnet (default)

Is this a regression?

Yes, this worked in a previous version

Last Working Version

_No response_

Claude Code Version

2.1.195

Platform

Anthropic API

Operating System

Windows

Terminal/Shell

Windows Terminal

Additional Information

No screenshots are attached — the flash is a sub-second visual event (a
window appears and disappears almost instantly), which is difficult to
capture as a static screenshot. If useful, a short screen recording (e.g.
via Windows Game Bar, Win+G) could potentially capture it, but this wasn't
attempted here.

No separate demo repository is included because none is needed: the issue
reproduces with the single simplest possible command (a bare echo via the
Bash tool, or Write-Output via the PowerShell tool — see "Steps to
Reproduce"). No project files, dependencies, or configuration are required.

Diagnostic context: this was first noticed during a long working session
that made heavy use of the Bash tool to drive a third-party console
application (an EDA/simulation tool) via Python's subprocess module. That
led to an initial (later disproven) hypothesis that the third-party
application was the source. Adding creationflags=subprocess.CREATE_NO_WINDOW
to the Python-side subprocess calls reduced the flash frequency but did not
eliminate it, and the flash was subsequently confirmed to occur on completely
unrelated, minimal commands via both the Bash and PowerShell tools with no
third-party software involved at all — isolating the cause to the Claude
Code client's own shell-invocation mechanism on Windows rather than any
specific command, script, or third-party tool being invoked.

Environment variables present in the shell session (values withheld as they
may contain internal/private endpoint info):
ANTHROPIC_BASE_URL, CLAUDE_CODE_SDK_HAS_HOST_AUTH_REFRESH,
CLAUDE_CODE_CHILD_SESSION, CLAUDE_CODE_SDK_HAS_OAUTH_REFRESH,
CLAUDE_CODE_OAUTH_SCOPES — these suggest the session was running through the
Claude Agent SDK embedded in a host application, rather than a standalone
interactive claude terminal session, which may be relevant context for
reproducing the exact invocation path.

View original on GitHub ↗