claude-code - 💡(How to fix) Fix [BUG] [Windows] Claude Desktop spawns exponentially self-replicating git.exe processes that continue after app closes (~7,500 processes in minutes) [1 comments, 2 participants]

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…
GitHub stats
anthropics/claude-code#49628Fetched 2026-04-17 08:35:48
View on GitHub
Comments
1
Participants
2
Timeline
6
Reactions
0
Author
Timeline (top)
labeled ×4commented ×1cross-referenced ×1

On Windows 11, opening Claude Desktop (Windows app) triggers git.exe processes that recursively spawn themselves in an exponential pattern, reaching 7,000+ processes within minutes. The runaway git.exe processes continue spawning even after Claude.exe is fully terminated — only uninstalling Claude Desktop completely stops the process explosion. taskkill and WMI-based termination cannot keep up with the spawn rate.

This is a critical bug that can exhaust system resources (Non-Paged Pool, TCP/UDP ports, handle tables) and destabilize the OS — in my case, WSL failed to start after the incident and required a reboot to recover.


Root Cause

On Windows 11, opening Claude Desktop (Windows app) triggers git.exe processes that recursively spawn themselves in an exponential pattern, reaching 7,000+ processes within minutes. The runaway git.exe processes continue spawning even after Claude.exe is fully terminated — only uninstalling Claude Desktop completely stops the process explosion. taskkill and WMI-based termination cannot keep up with the spawn rate.

This is a critical bug that can exhaust system resources (Non-Paged Pool, TCP/UDP ports, handle tables) and destabilize the OS — in my case, WSL failed to start after the incident and required a reboot to recover.


Fix Action

Workaround

Until fixed: do not open the Code tab in Claude Desktop on Windows. Chat mode alone is safe (no git probing observed). If the fork bomb is triggered, the only reliable way to stop it is to uninstall Claude Desktop entirely.


Code Example

while ($true) {
    $g = (Get-Process git -ErrorAction SilentlyContinue | Measure-Object).Count
    $c = (Get-Process claude -ErrorAction SilentlyContinue | Measure-Object).Count
    "$(Get-Date -Format 'HH:mm:ss') - git: $g, claude: $c"
    Start-Sleep -Seconds 3
}

---

19:50:10 - git: 0,  claude: 0   ← before launch
19:50:22 - git: 0,  claude: 2Claude Desktop starts
19:50:28 - git: 0,  claude: 9   ← stable chat mode
19:51:17 - git: 0,  claude: 9   ← still stable after 1+ minute

---

19:51:20 - git: 42,   claude: 10Code tab opened
19:51:23 - git: 250,  claude: 10+208 in 3 seconds
19:51:26 - git: 438,  claude: 9
19:51:29 - git: 629,  claude: 9
19:51:35 - git: 995,  claude: 9
19:51:44 - git: 1514, claude: 9
19:51:56 - git: 2115, claude: 9

---

19:52:44 - git: 1581, claude: 0Claude fully closed
19:52:50 - git: 1880, claude: 0   ← git still growing without a parent claude.exe!
19:53:15 - git: 2885, claude: 0
19:54:04 - git: 4633, claude: 0
19:55:02 - git: 6141, claude: 0
19:56:13 - git: 7531, claude: 0~7,500 zombie git processes

---

19:56:13 - git: 7531, claude: 0   ← uninstall in progress
19:56:17 - git: 508,  claude: 0   ← uninstall completes, spawn stops
19:56:20 - git: 0,    claude: 0   ← cleanup complete
19:56:32 - git: 0,    claude: 0   ← stable

---

git.exe -c core.hooksPath=/dev/null -c safe.directory=* --version

---

ProcessId  ParentProcessId  CommandLine
---------  ---------------  -----------
265384     265476           git.exe -c core.hooksPath=/dev/null -c safe.directory=* --version
265316     265384           git.exe -c core.hooksPath=/dev/null -c safe.directory=* --version
250884     265316           git.exe -c core.hooksPath=/dev/null -c safe.directory=* --version
250996     250884           git.exe -c core.hooksPath=/dev/null -c safe.directory=* --version
233792     250996           git.exe -c core.hooksPath=/dev/null -c safe.directory=* --version
42560      233792           git.exe -c core.hooksPath=/dev/null -c safe.directory=* --version
... (thousands more, same pattern)
RAW_BUFFERClick to expand / collapse

Summary

On Windows 11, opening Claude Desktop (Windows app) triggers git.exe processes that recursively spawn themselves in an exponential pattern, reaching 7,000+ processes within minutes. The runaway git.exe processes continue spawning even after Claude.exe is fully terminated — only uninstalling Claude Desktop completely stops the process explosion. taskkill and WMI-based termination cannot keep up with the spawn rate.

This is a critical bug that can exhaust system resources (Non-Paged Pool, TCP/UDP ports, handle tables) and destabilize the OS — in my case, WSL failed to start after the incident and required a reboot to recover.


Environment

  • OS: Windows 11
  • Shell: PowerShell 7.6.0 (running as Administrator)
  • Git: Git for Windows (standard install)
  • Claude Desktop: Latest version as of April 2026 (Opus 4.7 1M available in-app)
  • NOT installed: Claude Code CLI, Claude Code VS Code extension, any Claude-related VS Code / Cursor extensions
  • No Claude-related startup items in Win32_StartupCommand
  • No .claude/settings.json or .claude-mem/settings.json on disk
  • where.exe claude returns nothing (no CLI / PATH hijacking)

Steps to Reproduce

  1. Install Claude Desktop on Windows 11 (standard installer, bundles Cowork / agent mode)
  2. Open Claude Desktop — chat mode works fine, claude.exe stabilizes at ~9 processes, git.exe stays at 0
  3. Switch to the Code tab within Claude Desktop (the GUI with "Routines", "Local / Select folder", "Accept edits", model selector showing "Opus 4.7 1M · Extra high")
  4. Observe git.exe process count explode

Observed Behavior

Live monitoring with:

while ($true) {
    $g = (Get-Process git -ErrorAction SilentlyContinue | Measure-Object).Count
    $c = (Get-Process claude -ErrorAction SilentlyContinue | Measure-Object).Count
    "$(Get-Date -Format 'HH:mm:ss') - git: $g, claude: $c"
    Start-Sleep -Seconds 3
}

Phase 1: Chat mode only (safe)

19:50:10 - git: 0,  claude: 0   ← before launch
19:50:22 - git: 0,  claude: 2   ← Claude Desktop starts
19:50:28 - git: 0,  claude: 9   ← stable chat mode
19:51:17 - git: 0,  claude: 9   ← still stable after 1+ minute

Phase 2: Opening the Code tab triggers fork bomb

19:51:20 - git: 42,   claude: 10   ← Code tab opened
19:51:23 - git: 250,  claude: 10   ← +208 in 3 seconds
19:51:26 - git: 438,  claude: 9
19:51:29 - git: 629,  claude: 9
19:51:35 - git: 995,  claude: 9
19:51:44 - git: 1514, claude: 9
19:51:56 - git: 2115, claude: 9

Phase 3: Claude closed, git.exe continues to multiply

After closing Claude Desktop window (claude.exe count drops to 0), git.exe continues to grow:

19:52:44 - git: 1581, claude: 0   ← Claude fully closed
19:52:50 - git: 1880, claude: 0   ← git still growing without a parent claude.exe!
19:53:15 - git: 2885, claude: 0
19:54:04 - git: 4633, claude: 0
19:55:02 - git: 6141, claude: 0
19:56:13 - git: 7531, claude: 0   ← ~7,500 zombie git processes

Phase 4: Uninstalling Claude Desktop immediately stops the spawn

19:56:13 - git: 7531, claude: 0   ← uninstall in progress
19:56:17 - git: 508,  claude: 0   ← uninstall completes, spawn stops
19:56:20 - git: 0,    claude: 0   ← cleanup complete
19:56:32 - git: 0,    claude: 0   ← stable

The moment Windows "Apps → Installed apps" reported the Claude app gone, git.exe went from 7,531 → 0 within 3 seconds.


Process Command Line Signature

All runaway git.exe processes share this exact command line:

git.exe -c core.hooksPath=/dev/null -c safe.directory=* --version

Process Tree Analysis

Using Get-CimInstance Win32_Process -Filter "Name='git.exe'" during the incident, the parent process of nearly every git.exe is another git.exe, forming a self-referential chain:

ProcessId  ParentProcessId  CommandLine
---------  ---------------  -----------
265384     265476           git.exe -c core.hooksPath=/dev/null -c safe.directory=* --version
265316     265384           git.exe -c core.hooksPath=/dev/null -c safe.directory=* --version
250884     265316           git.exe -c core.hooksPath=/dev/null -c safe.directory=* --version
250996     250884           git.exe -c core.hooksPath=/dev/null -c safe.directory=* --version
233792     250996           git.exe -c core.hooksPath=/dev/null -c safe.directory=* --version
42560      233792           git.exe -c core.hooksPath=/dev/null -c safe.directory=* --version
... (thousands more, same pattern)

Each git.exe spawns approximately 1 new git.exe every 20–50 ms, giving exponential growth of ~100–200 new processes per 3-second observation window.


Expected Behavior

  • A single git --version probe should execute, return, and terminate cleanly
  • Closing Claude Desktop should terminate all child processes it spawned
  • No recursive self-spawning should occur under any condition
  • No process should survive after the parent app is uninstalled

Attempted Mitigations (all failed while Claude Desktop was installed)

  • taskkill /f /im git.exe — kills a batch, but new processes spawn faster than kill can keep up
  • Loop: for ($i=0; $i -lt 20; $i++) { taskkill /f /im git.exe 2>$null; Start-Sleep -Milliseconds 300 } — same problem
  • WMI Terminate: Get-CimInstance Win32_Process -Filter "Name='git.exe'" | ForEach-Object { Invoke-CimMethod -InputObject $_ -MethodName Terminate } — same problem
  • Closing Claude Desktop window — claude.exe terminates but git.exe continues multiplying indefinitely
  • Only uninstalling Claude Desktop via Settings → Apps → Installed apps actually stopped the spawn.

System Impact

  • Non-Paged Pool exhaustion: After the first incident of this bug, WSL failed to start (wsl command hangs indefinitely). A full system reboot was required to restore WSL functionality. This matches the symptoms reported in issue #42169.
  • Potential UDP port / handle table saturation if the bug runs long enough
  • Risk of system instability (DWM crash, Windows Terminal crash) matching similar issues

Hypothesis

The -c core.hooksPath=/dev/null -c safe.directory=* flags suggest this is Claude Desktop's (or the bundled Cowork agent's) git environment probe, specifically designed to be non-recursive by disabling hooks and bypassing the safe-directory check. However, on this system the probe enters an infinite spawn loop.

The fact that git.exe continues multiplying after claude.exe is fully terminated strongly suggests one of:

  1. A detached background worker (Windows Scheduled Task, service, or orphaned child) continues invoking git
  2. A Cowork/agent helper process that outlives the main Electron shell
  3. Some form of retry/spawn logic in a git wrapper that Claude Desktop installs

The uninstall-stops-everything behavior further suggests the mechanism is tied to a registered Windows component that uninstall removes.


Suggested Investigation

  1. Audit every Claude Desktop / Cowork component that invokes git.exe -c core.hooksPath=/dev/null -c safe.directory=* --version — why does it retry recursively, and why does it survive the main claude.exe process?
  2. Check whether Claude Desktop / Cowork registers a Windows Scheduled Task, background service, or native Windows component that continues running after the main app closes
  3. Verify that the git probe has a hard retry limit and cannot self-invoke
  4. Ensure the Code tab's "Local folder" scanning path has a recursion guard and a spawn-rate limit
  5. Confirm that closing the main window performs full child-process cleanup (including any detached helpers)

Related Issues

  • #42169 — claude.exe accumulates 13+ GB virtual memory, triggers Windows Resource Exhaustion (same Non-Paged Pool symptom)
  • #36929 — [Windows] claude.exe spawns multiple processes, consuming ~4.8 GB RAM at idle
  • #32792 — [BUG] [Windows] Multiple claude.exe processes spawn each time Claude Code panel is opened
  • #29045 — [BUG] Claude Desktop spawns 1.8 GB Hyper-V VM on every launch, even for chat-only use

This issue appears to be a more severe escalation of the Windows-specific process-management problems documented across these reports.


Workaround

Until fixed: do not open the Code tab in Claude Desktop on Windows. Chat mode alone is safe (no git probing observed). If the fork bomb is triggered, the only reliable way to stop it is to uninstall Claude Desktop entirely.


Severity

Critical. A single accidental click on the Code tab can exhaust system resources within minutes and destabilize other system components (WSL, Hyper-V, possibly more). Average users cannot self-diagnose this — it presents as "my computer got slow and WSL broke after installing Claude."

extent analysis

TL;DR

The most likely fix for the exponential git.exe process spawn issue in Claude Desktop on Windows 11 is to identify and address the root cause of the recursive git probe invocation, potentially by modifying the git environment probe to include a retry limit and ensuring proper cleanup of child processes when the main claude.exe process terminates.

Guidance

  1. Investigate the git probe invocation: Audit every Claude Desktop/Cowork component that invokes git.exe -c core.hooksPath=/dev/null -c safe.directory=* --version to understand why it retries recursively and survives the main claude.exe process.
  2. Check for registered Windows components: Verify if Claude Desktop/Cowork registers a Windows Scheduled Task, background service, or native Windows component that continues running after the main app closes, potentially causing the recursive spawn.
  3. Implement a retry limit: Ensure the git probe has a hard retry limit to prevent infinite recursion.
  4. Verify child-process cleanup: Confirm that closing the main window performs full child-process cleanup, including any detached helpers.
  5. Code review: Review the Code tab's "Local folder" scanning path to ensure it has a recursion guard and a spawn-rate limit.

Example

No specific code snippet can be provided without more information on the internal implementation of Claude Desktop. However, a general example of how to limit retries in a PowerShell script could be:

$maxRetries = 5
$retryCount = 0
while ($retryCount -lt $maxRetries) {
    # Invoke git probe
    $retryCount++
}

Notes

The provided information suggests a complex issue deeply rooted in the interaction between Claude Desktop, its components, and the Windows environment. Without access to the source code or more detailed logs, pinpointing the exact cause and providing a precise fix is challenging.

Recommendation

Apply a workaround by not opening the Code tab in Claude Desktop on Windows until a fix is implemented, as chat mode alone appears to be safe. If the issue is triggered, uninstalling Claude Desktop entirely stops the process spawn, but this is not a viable long-term solution.

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