[BUG] [Windows] PATH environment variable deleted when Claude Code attempts to append

Resolved 💬 7 comments Opened Aug 24, 2025 by salmansayyad Closed Feb 2, 2026

Description

Claude Code completely wiped my user PATH environment variable while attempting to add a program to the PATH, making all development tools inaccessible.

What happened

  1. Working on a project that required adding a tool to PATH
  2. Claude Code attempted to add it using: setx PATH "%PATH%;C:\Program Files\[tool-name]"
  3. Instead of appending, it replaced my entire PATH with just the new entry

Expected behavior

The command should append to the existing PATH, preserving all other entries.

Actual behavior

The entire user PATH was replaced with only the new path, deleting all existing entries including development tools, compilers, and system utilities.

Root cause

The %PATH% variable failed to expand properly in Claude Code's execution context. The command effectively became setx PATH ";C:\Program Files\[tool-name]" with an empty PATH.

Impact

  • Complete loss of PATH environment variable
  • Development environment broken
  • Manual restoration required
  • No backup or warning provided

Suggested fixes

  1. Create backup before modifying environment variables
  2. Verify %PATH% expands correctly before executing
  3. Use safer append methods

Severity

Critical - Causes data loss and breaks development environments without warning.

Steps to reproduce

  1. Use Claude Code on Windows
  2. Work on a project requiring PATH modification
  3. Allow Claude Code to add to PATH
  4. Check Environment Variables - PATH will be replaced instead of appended

Environment

  • OS: Windows 11
  • Claude Code: 1.0.88

View original on GitHub ↗

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