Skip to content

Path Normalization Failure: Doubled Unix Drive Prefix in Windows Environments #5401

Closed as not planned

Description

@JasonCubic

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:

  1. File Write Test: Used path /c/trucktech_sandbox/aws-bedrock-cc/filename
  2. Actual File Location: Found at /c/c/trucktech_sandbox/aws-bedrock-cc/filename
  3. Path Corruption Pattern: Claude Code adds extra /c/ prefix to Unix-style paths
  4. 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-cc in 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:

  1. VS Code extension reports workspace: c:\trucktech_sandbox\aws-bedrock-cc
  2. Claude Code CLI corrupts current directory to: /c/c/trucktech_sandbox/aws-bedrock-cc
  3. Path matching logic compares corrupted path vs. correct path → MISMATCH
  4. Result: "workspace/project directories do not match the current cwd"

Reproduction Steps

  1. Open VS Code in Windows directory
  2. Use Git Bash as integrated terminal
  3. Run Claude Code CLI
  4. Attempt /ide command - fails path matching
  5. Attempt file operations with Unix-style paths - files don't appear
  6. 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:

  1. Debug the path normalization logic that converts /c/... → should become C:\... not /c/c/...
  2. Implement proper Git Bash path handling without prefix doubling
  3. Add path normalization unit tests covering Git Bash, PowerShell, CMD environments
  4. Test IDE integration path matching with normalized paths
  5. 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

[]

Activity

  1. github-actions commented on Aug 8, 2025

    @github-actions

    Found 2 possible duplicate issues:

    1. [BUG] CRITICAL: Write tool creates files outside working directory on Windows #4771
    2. [BUG] Windows: MCP server fails with /d: Is a directory -> MCP error -32000: Connection closed #5098

    If your issue is a duplicate, please close it and 👍 the existing issue instead.

    This issue will be automatically closed as a duplicate in 3 days if there are no additional comments. To prevent auto-closure, please 👎 this comment.

    🤖 Generated with Claude Code

  2. self-assigned this
    on Aug 8, 2025
  3. added
    duplicateThis issue or pull request already exists
    and removed
    bugSomething isn't working
    has reproHas detailed reproduction steps
    platform:windowsIssue specifically occurs on Windows
    on Aug 15, 2025
  4. github-actions commented on Aug 15, 2025

    @github-actions

    This issue has been automatically closed as a duplicate of #4771.

    If this is incorrect, please re-open this issue or create a new one.

    🤖 Generated with Claude Code

  5. github-actions commented on Aug 23, 2025

    @github-actions

    This issue has been automatically locked since it was closed and has not had any activity for 7 days. If you're experiencing a similar issue, please file a new issue and reference this one if it's relevant.

  6. locked as resolved and limited conversation to collaborators on Aug 23, 2025
  7. unlocked this conversation on Aug 27, 2025
  8. github-actions commented on Dec 4, 2025

    @github-actions

    This issue has been inactive for 30 days. If the issue is still occurring, please comment to let us know. Otherwise, this issue will be automatically closed in 30 days for housekeeping purposes.

  9. DjWarmonger commented on Dec 9, 2025

    @DjWarmonger

    Yes the issue is still occuring. I can't run script from Claude Code hook since it doesn't resolve script path correctly.

  10. meghuizen commented on Dec 9, 2025

    @meghuizen

    It's still an issue, claude code hooks says that the environment variable $CLAUDE_PROJECT_DIR is not existing.

  11. github-actions commented on Jan 11, 2026

    @github-actions

    This issue has been automatically closed due to 60 days of inactivity. If you're still experiencing this issue, please open a new issue with updated information.

  12. github-actions commented on Jan 19, 2026

    @github-actions

    This issue has been automatically locked since it was closed and has not had any activity for 7 days. If you're experiencing a similar issue, please file a new issue and reference this one if it's relevant.

  13. locked as resolved and limited conversation to collaborators on Jan 19, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

duplicateThis issue or pull request already exists

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions