Auto-updater fails repeatedly with "claude.exe in use" whenever a session is running (Windows)
Environment
- OS: Windows 11 Enterprise, build 10.0.26200
- Install method: npm global (
@anthropic-ai/claude-code) - Channel:
latest(default, unset)
Observed behavior
Background auto-update repeatedly shows a red "Auto-update failed... claude.exe in use" message during active sessions. Investigated to rule out a stray/zombie process before reporting:
- Only one
claudeprocess was found running at the time of the failure - the active session itself (confirmed viaGet-Process/Get-CimInstanceon Windows). No orphaned instance was holding the file. - The installed version did advance from
2.1.228to2.1.231over a ~2-day span, but not via a successful background auto-update - I had to exit the running session manually and runclaude updateby hand to get the new version. I have not observed the background auto-update mechanism itself ever complete successfully while a session was open; every version change I've seen has required manual intervention.
Suspected root cause
Windows won't allow an executable to be overwritten while it's the one currently running - including by itself. If the updater attempts an in-place overwrite of claude.exe rather than the common Windows self-update pattern (write the new binary alongside/rename the running exe aside, then swap), it can only ever succeed when zero Claude Code processes are active anywhere on the machine. For a user who keeps a session open most of the day, that's a rare-to-nonexistent window in practice, making the "failed" error the constant case rather than the exception - for what may be an entirely expected, non-actionable condition, but currently surfaces as a repeated red error with no clear guidance that manual claude update is the actual path forward.
Suggested fixes (not verified against actual source, just the pattern that would resolve the symptom)
- Use a rename-aside-then-replace update strategy so it succeeds even while the current process is executing.
- If (1) isn't feasible, don't surface this specific condition as a red "failed" error - it's expected, not actionable, and retrying silently (or with a one-time hint to run
claude updatemanually) would be less alarming. - Skip the update attempt entirely if the running version already matches the latest known target, to avoid redundant retries.
Workaround in use: setting DISABLE_AUTOUPDATER=1 to stop background attempts and updating manually via claude update instead.