[BUG] Windows: napi-rs native addon temp files never cleaned up, accumulating 100+ GB

Resolved 💬 4 comments Opened Feb 8, 2026 by liminalcommons Closed Mar 12, 2026

Bug Description

Claude Code extracts native Node.js addon binaries (ripgrep, tokenizer) to %TEMP% on every launch/subprocess spawn via the napi-rs bundler. These .node DLL files are never cleaned up on process exit, causing unbounded disk accumulation.

Impact

On my Windows machine over ~7 weeks of daily Claude Code usage:

  • 32,900 orphaned .node files in %TEMP%
  • 159 GB of wasted disk space
  • Drive was down to 2.37 GB free before manual cleanup

Reproduction

  1. Use Claude Code on Windows for several days
  2. Check: Get-ChildItem "$env:TEMP\*.node" -File | Measure-Object -Property Length -Sum
  3. Observe files accumulating ~4.8 MB each, never deleted

File Details

Each file is a unique extraction of the same native addon binaries:

  • Filename pattern: random hex strings like a1b2c3d4.node
  • Size: ~4.8 MB each (ripgrep, tokenizer binaries)
  • Created by: napi-rs @napi-rs/cli bundler during process startup
  • The originals remain embedded in the npm package

Root Cause

The napi-rs bundler extracts .node binaries to %TEMP% on each process spawn (including subagent processes) but doesn't register any cleanup hook (process.on('exit', ...) or similar) to delete them.

Expected Behavior

Claude Code should either:

  1. Clean up extracted .node files on process exit
  2. Reuse a single extraction location (e.g., %LOCALAPPDATA%/claude-code/native/) instead of creating unique temp files per process
  3. Use atexit / process.on('exit') hooks to delete temp extractions

Workaround

Manual cleanup via PowerShell:

Get-ChildItem "$env:TEMP\*.node" -File |
    Where-Object { $_.LastWriteTime -lt (Get-Date).AddDays(-1) } |
    Remove-Item -Force -ErrorAction SilentlyContinue

Environment

  • OS: Windows 11
  • Claude Code: latest (as of Feb 2026)
  • Usage: Daily, heavy (multiple sessions with parallel subagents)
  • Accumulation period: ~7 weeks (Dec 19, 2025 - Feb 8, 2026)

View original on GitHub ↗

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