/heapdump fails on Windows: EEXIST error when Desktop directory already exists

Resolved 💬 3 comments Opened Mar 11, 2026 by akr-n Closed Mar 15, 2026

Bug Report

Command: /heapdump

Platform: Windows 11 Pro (win32)

Error:

Failed to create heap dump: EEXIST: file already exists, mkdir 'C:\Users\anupi\Desktop'

Description

Running /heapdump in response to a high memory usage warning (4.8GB) fails on Windows because the command attempts to mkdir the Desktop directory, but that directory already exists.

The command should check if the target directory exists before trying to create it, or use a different approach (e.g., mkdirSync with { recursive: true } option) to avoid this error.

Steps to Reproduce

  1. Run Claude Code on Windows 11
  2. Receive high memory usage warning
  3. Run /heapdump as suggested
  4. Error occurs: EEXIST: file already exists, mkdir 'C:\Users\anupi\Desktop'

Expected Behavior

A .heapsnapshot file should be created on the Desktop (or another accessible path) for memory analysis.

Actual Behavior

Command fails with EEXIST error and no heap dump is created, leaving the user unable to diagnose memory issues.

View original on GitHub ↗

This issue has 3 comments on GitHub. Read the full discussion on GitHub ↗