[BUG] Windows 11: visible terminal popup with 'claude --print --permission-...' showing stdin error during normal use
Environment
- OS: Windows 11 Home 10.0.26200
- Claude Code version: 2.1.105
- Terminal: PowerShell (Windows Terminal)
- Frequency: Intermittent, multiple times per session during normal use
Symptom
A visible console/terminal window appears unexpectedly with the title bar showing:
claude --print --permission-...
The window body shows:
Error: Input must be provided either through stdin or as a prompt argument when using --print
The window stays open until the user manually closes it. It appears during normal Claude Code sessions, including when the Agent tool dispatches sub-agents or when internal permission-mode subroutines run.
Steps to Reproduce
- Run Claude Code on Windows 11 (any terminal)
- Use Claude Code normally — trigger any workflow that causes the harness to spawn an internal
claudesubprocess (e.g. Agent tool sub-agent dispatch, or an internal permission-check subprocess) - Observe: a new terminal window appears with the title
claude --print --permission-...and the stdin error
Root Cause Hypothesis
The Claude Code harness spawns claude subprocesses (for sub-agent dispatch or permission-mode operations) using child_process.spawn() or equivalent without windowsHide: true. On Windows, this causes a visible console window to appear for any subprocess that allocates a console. The subprocess then fails to receive its prompt input via stdin (likely a stdin race or shell-shim issue on Windows), producing the error message.
What Has Been Ruled Out
User-defined hook scripts have been fully audited — a comprehensive grep across all .cjs, .js, .ts, .ps1, .sh, .bat files and package.json in both the project repo and ~/.claude/ confirms:
- Zero hook scripts spawn
claudeas a subprocess - All
spawn/execcalls in hook scripts invokenode,git,npm,tsx, orPowerShell— neverclaude - Two previously-suspected scripts (
scripts/hooks/memory-precompact.cjs,scripts/hooks/memory-compiler.cjs) were already updated to usewindowsHide: trueandshell: false— the popup still appears after these fixes
This rules out user-defined hooks as the source. The spawning must originate inside the harness itself.
Related Issues
- #19391 — Windows popup issue (closed as not planned)
- #20814 — Windows console popup + zombie node.exe (closed as not planned)
- #15572 — Console windows flash on Bash commands, missing
windowsHide(closed as duplicate) - #19012 — Hook commands cause console window flash (closed as not planned)
None of the above covers this specific variant: the popup title includes claude --print --permission-... and the content is a stdin error — meaning it is specifically the harness spawning a claude subprocess that fails to receive its stdin prompt.
Requested Fix
When the harness spawns any internal claude subprocess on Windows, pass windowsHide: true (and shell: false) to suppress the console window allocation. This option is cross-platform safe — it is silently ignored on macOS/Linux.
Additionally, investigate the stdin delivery race: the subprocess is invoked with --print (non-interactive mode) but fails to receive its prompt input, suggesting the piped stdin is not being flushed/closed before the subprocess reads it.
Workaround
No known workaround. Settings like windowsHide, silentSubAgents, or noConsoleWindow do not appear to exist in settings.json. Attempts to patch via NODE_OPTIONS are sanitized by the harness. This is a harness-level fix.
This issue has 3 comments on GitHub. Read the full discussion on GitHub ↗