Path Normalization Failure: Doubled Unix Drive Prefix in Windows Environments
Bug Description
Claude Code Critical Path Corruption Bug Report
Summary
CRITICAL PATH CORRUPTION BUG: Claude Code systematically corrupts Git Bash Unix-style paths by doubling the /c/ prefix, causing cascading failures across multiple subsystems including IDE integration and file operations.
Forensic Evidence - Path Doubling Bug Discovered
SMOKING GUN: Direct evidence of path corruption found through filesystem forensics:
- File Write Test: Used path
/c/trucktech_sandbox/aws-bedrock-cc/filename - Actual File Location: Found at
/c/c/trucktech_sandbox/aws-bedrock-cc/filename - Path Corruption Pattern: Claude Code adds extra
/c/prefix to Unix-style paths - IDE Integration Failure: Corrupted path prevents workspace matching
The Connection: VS Code reports c:\trucktech_sandbox\aws-bedrock-cc but Claude Code's corrupted path becomes /c/c/trucktech_sandbox/aws-bedrock-cc → NO MATCH → IDE integration fails
Environment Details
- Claude Code Version: 1.0.71
- Platform: Windows (MSYS_NT-10.0-22631 3.4.10-87d29.x86_64)
- IDE: Visual Studio Code
- Shell: Git Bash (MSYS)
- Working Directory:
C:\trucktech_sandbox\aws-bedrock-cc(displayed as/c/trucktech_sandbox/aws-bedrock-ccin Git Bash)
Issue Description
Claude Code exhibits systematic path normalization failures affecting multiple subsystems:
IDE Integration Issue
Select IDE
Connect to an IDE for integrated development features.
No available IDEs detected. Make sure your IDE has the Claude Code extension or plugin
installed and is running.
Found 1 other running IDE(s). However, their workspace/project directories do not match
the current cwd.
• Visual Studio Code: c:\trucktech_sandbox\aws-bedrock-cc
File Operations Issue
- Write tool reports success but files don't appear on filesystem
- Security errors show malformed paths like
'C:\c\trucktech_sandbox\aws-bedrock-cc'
Root Cause Analysis - Path Doubling Bug
UNIFIED ROOT CAUSE IDENTIFIED: Claude Code's path normalization logic corrupts Unix-style paths by doubling the drive prefix:
The Bug Pattern:
- Input Path (Git Bash):
/c/trucktech_sandbox/aws-bedrock-cc - Corrupted Path (Claude Code):
/c/c/trucktech_sandbox/aws-bedrock-cc - Expected Path (Correct):
C:\trucktech_sandbox\aws-bedrock-cc - VS Code Path (Reference):
c:\trucktech_sandbox\aws-bedrock-cc
Why IDE Integration Fails:
- VS Code extension reports workspace:
c:\trucktech_sandbox\aws-bedrock-cc - Claude Code CLI corrupts current directory to:
/c/c/trucktech_sandbox/aws-bedrock-cc - Path matching logic compares corrupted path vs. correct path → MISMATCH
- Result: "workspace/project directories do not match the current cwd"
Reproduction Steps
- Open VS Code in Windows directory
- Use Git Bash as integrated terminal
- Run Claude Code CLI
- Attempt
/idecommand - fails path matching - Attempt file operations with Unix-style paths - files don't appear
- Security errors show malformed path concatenation
Impact
- ❌ IDE integration completely broken
- ❌ File operations unreliable
- ❌ Path-dependent features failing
- ✅ Basic CLI functionality works (reading existing files, bash commands)
Workaround
Using Windows-style paths (C:\...) instead of Git Bash paths (/c/...) may resolve file operation issues.
Definitive Reproduction Test
Proof of Path Corruption (easily reproducible):
# In Claude Code CLI (Git Bash environment):
# 1. Write file using Unix-style path
# 2. Search filesystem to find where it actually went
# 3. Observe the doubled /c/c/ path corruption
# Expected: /c/trucktech_sandbox/aws-bedrock-cc/test-file.txt
# Actual: /c/c/trucktech_sandbox/aws-bedrock-cc/test-file.txt
Priority Level
CRITICAL - This bug breaks core Claude Code functionality on Windows with Git Bash, affecting:
- IDE integration (primary user workflow)
- File operations (data integrity risk)
- Path-dependent security boundaries
Suggested Fix
Primary Fix Required: Fix path doubling corruption in Unix-to-Windows path conversion:
- Debug the path normalization logic that converts
/c/...→ should becomeC:\...not/c/c/... - Implement proper Git Bash path handling without prefix doubling
- Add path normalization unit tests covering Git Bash, PowerShell, CMD environments
- Test IDE integration path matching with normalized paths
- Verify file operations work correctly across shell environments
Secondary Improvements:
- Case-insensitive path matching for IDE detection
- Consistent path format normalization before comparisons
- Better error messaging when path operations fail
Environment Info
- Platform: win32
- Terminal: vscode
- Version: 1.0.71
- Feedback ID: 79634380-a774-4d51-a024-e1789aaa1686
Errors
[]This issue has 8 comments on GitHub. Read the full discussion on GitHub ↗