[BUG] Claude Desktop hangs on Windows when gitDiff retry exceeds ENAMETOOLONG

Resolved 💬 1 comment Opened Apr 13, 2026 by msgtechltd Closed May 25, 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?

Claude Desktop becomes completely unresponsive (hangs) on Windows when switching session focus triggers a getGitDiff operation on a repo with many files. The app must be force-killed from Task Manager.

What Should Happen?

Claude Desktop shouldn't hang

Error Messages/Logs

Root Cause (from logs)

  main.log shows this sequence on every session focus switch:

  [gitDiff] patch output exceeded 5242880 bytes for <project-path>; retrying without 371 large file(s)
  [gitDiff] Error getting git diff: Error: spawn ENAMETOOLONG

  The retry builds a git diff command that excludes hundreds of files by name on the command line. With deep paths (~100+ chars
  each), 371 exclusions produce a ~37KB+ command line, exceeding Windows' 32KB argument limit (ENAMETOOLONG).

  This error appears to fire on the Electron main thread, blocking all UI rendering — the permission/plan approval dialog becomes
   unclickable, and the entire window hangs.

  Evidence

  - Windows Event Log shows repeated Application Hang (Event ID 1002) for claude.exe across versions 1.569, 1.1062, 1.1348, and
  1.1617
  - Consistently reproducible — happened 7+ times over one week
  - Get-Process reports all Claude processes as Responding: True even while the UI is frozen (Electron main thread deadlock, not
  a process crash)

  Environment

  - Windows 11 Home 10.0.26200
  - Claude Desktop (MSIX, multiple versions affected)
  - Project on OneDrive-synced directory with deep file paths

  Suggested Fix

  - Run getGitDiff off the main thread (non-blocking)
  - Cap the number of file exclusions in the retry, or use a different strategy (e.g., write exclusions to a temp file and use
  git diff --exclude-from)
  - Gracefully degrade when diff exceeds size limit instead of crashing the retry

Steps to Reproduce

  1. Open a project with a large working tree diff (e.g., 50+ modified/untracked files with deep nested paths)
  2. Have Claude generate a plan or tool permission request
  3. Switch focus to another application while the approval dialog is showing
  4. Switch back — Claude Desktop is frozen, UI unresponsive

Claude Model

None

Is this a regression?

Yes, this worked in a previous version

Last Working Version

_No response_

Claude Code Version

2.1.104

Platform

Anthropic API

Operating System

Windows

Terminal/Shell

PowerShell

Additional Information

_No response_

View original on GitHub ↗

This issue has 1 comment on GitHub. Read the full discussion on GitHub ↗