[BUG] Windows: claude agents spawn visible reg.exe console windows during background session startup

Status Fixed / completed
Reported on v2.1.165
Maintainer reply None cached
Activity 6 comments · opened Jun 5, 2026 · closed Jun 27, 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?

When using claude agents on native Windows, Claude Code spawns visible reg.exe console windows.

This happens when starting claude agents itself and again when submitting a task from the agent dashboard. It does not reproduce in regular interactive Claude Code sessions.

The visible popup title captured by a Win32 top-level-window watcher is:

C:\WINDOWS\System32\reg.exe

WMI process creation tracing shows the reg.exe processes are spawned directly by claude.exe, not by repo hooks, user scripts, VS Code, WSL, or the active shell.

The issue is shell-independent: it reproduces from PowerShell, Git Bash, and cmd. The machine is configured for Windows Console Host, and the issue also reproduces when using Windows Terminal.

What Should Happen?

Claude Code’s internal registry probes during claude agents / background-session startup should not create visible console windows.

They should use CREATE_NO_WINDOW / windowsHide: true where applicable, or preferably native Windows registry APIs such as RegGetValue instead of spawning reg.exe.

Error Messages/Logs

[11:37:44] reg.exe PID=53464 CMD=C:\WINDOWS\System32\reg.exe query HKLM\SOFTWARE\Policies\ClaudeCode /v Settings
  parent:      claude.exe --bg-pty-host \\.\pipe\cc-daemon-... -- claude.exe --session-id ... --agent claude --permission-mode bypassPermissions -- "<prompt>"
  grandparent: claude.exe daemon run --json-path C:\Users\<user>\.claude\daemon.json ... --spawned-by "{\"label\":\"claude agents\", ...}"

[11:39:25] reg.exe PID=36576 CMD=<already exited>
  parent:      claude.exe --bg-pty-host ... (same shape as above)
  grandparent: claude.exe daemon run ... "claude agents"

[11:40:16] reg.exe PID=52704 CMD=C:\Windows\System32\reg.exe query HKEY_CURRENT_USER\Software\Classes\claude-cli\shell\open\command /ve
  parent:      claude.exe --session-id ... --agent claude --permission-mode bypassPermissions
  grandparent: claude.exe --bg-pty-host ... (same session)

Steps to Reproduce

  1. On native Windows, open PowerShell, Git Bash, or cmd.
  2. Run claude agents.
  3. Observe brief reg.exe console windows flashing.
  4. Submit a task from the agent dashboard.
  5. Observe additional reg.exe console windows, often in rapid groups.

To attribute the popups:

  • Use a Win32 EnumWindows watcher to capture the visible window title.
  • Use WMI Win32_Process creation events to capture process parentage.

Claude Model

Opus

Is this a regression?

Yes, this worked in a previous version

Last Working Version

Unknown

Claude Code Version

2.1.165 (Claude Code)

Platform

Anthropic API

Operating System

Windows

Terminal/Shell

PowerShell

Additional Information

Native Windows install at:

C:\Users\<user>\.local\bin\claude.exe

Not WSL, not VS Code-embedded.

Trace attribution:

  • HKLM\SOFTWARE\Policies\ClaudeCode /v Settings is parented by the --bg-pty-host wrapper process.
  • HKEY_CURRENT_USER\Software\Classes\claude-cli\shell\open\command /ve is parented by the inner --session-id ... --agent claude process.
  • Both originate from the claude.exe daemon run process used by claude agents.

Confirmed with:

  • Win32 EnumWindows watcher for visible windows
  • WMI Win32_Process creation events for process parentage

View original on GitHub ↗

5 Comments

github-actions[bot] · 2 months ago

Found 3 possible duplicate issues:

  1. https://github.com/anthropics/claude-code/issues/65171
  2. https://github.com/anthropics/claude-code/issues/63623
  3. https://github.com/anthropics/claude-code/issues/61051

This issue will be automatically closed as a duplicate in 3 days.

  • If your issue is a duplicate, please close it and 👍 the existing issue instead
  • To prevent auto-closure, add a comment or 👎 this comment

🤖 Generated with Claude Code

kigenst · 2 months ago

The issue here is not npm/npx/plugin subprocesses generally (#65171), not MCP server startup (#63623), and not regular tool execution / hooks (#61051).

This reproduces specifically with claude agents / background agent sessions, while regular interactive Claude Code sessions do not reproduce it.

Trojaner · 2 months ago

I can confirm this.
It happens with Windows Terminal and Claude Code v2.1.168

"claude agents" immediately pops up two reg.exe windows that exit with 1.
Opening new sessions from agents view triggers more reg.exe instances.

<img width="2560" height="1600" alt="Image" src="https://github.com/user-attachments/assets/9ee7c3a7-4fc1-4cc3-a28f-fb1e943f61aa" />

kigenst · 2 months ago

Still occurring in v2.1.170

kigenst · 2 months ago

Just noting that this suddenly stopped happening for me after a recent update: I no longer see reg.exe console windows flashing when starting Claude agents or submitting tasks. It was still happening on 2.1.170, so the fix landed sometime after that.

I don’t see an explicit changelog entry, but my guess is it was fixed incidentally by the --bg-pty-host process work in 2.1.172, which reworked how that wrapper’s background processes are spawned and managed on the daemon side. Since --bg-pty-host was one of the two spawn paths originally implicated, that refactor may have enabled windowsHide: true or removed the registry probe without a dedicated changelog note.

Showing cached comments. Read the full discussion on GitHub ↗