[BUG] Claude CLI Path Duplication on Windows

Resolved 💬 3 comments Opened Sep 27, 2025 by ratheh Closed Oct 1, 2025

Preflight Checklist

  • [x] I have searched existing issues and this hasn't been reported yet
  • [x] This is a single bug report (please file separate reports for different bugs)
  • [x] I am using the latest version of Claude Code

What's Wrong?

Summary

Claude CLI incorrectly duplicates Windows drive paths when launched from certain directories, causing "Path was not found" errors and preventing the CLI from functioning.

Environment

  • OS: Windows 10/11
  • Claude CLI Version: Latest (as of Sept 2025)
  • Installation Method: npm global install
  • Shell: Occurs in Command Prompt, PowerShell, and Git Bash
  • Node Version: v20.17.0

Bug Description

When running claude -p from a directory on a non-C: drive (e.g., D:\dev2\addons), Claude incorrectly duplicates the path as D:\d\dev2\addons, resulting in the error message:

Path D:\d\dev2\addons was not found.

The CLI then hangs indefinitely, waiting for input that never arrives due to the path error.

What Should Happen?

Expected Behavior

Claude should correctly parse the path as D:\dev2\addons and execute the command without errors.

Error Messages/Logs

Steps to Reproduce

Reproducible Examples

Command Prompt

D:\dev2\addons>echo "test" | claude -p
Path D:\d\dev2\addons was not found.
[hangs indefinitely]

PowerShell

PS D:\dev2\addons> echo "test" | claude -p
Path D:\d\dev2\addons was not found.
[hangs indefinitely]

Git Bash

$ pwd
/d/dev2/addons
$ echo "test" | claude -p
Path D:\d\dev2\addons was not found.
[hangs indefinitely]

Workaround

Running Claude from the C: drive or user home directory avoids the bug:

C:\Users\username>echo "test" | claude -p
[works correctly]

Claude Model

Not sure / Multiple models

Is this a regression?

I don't know

Last Working Version

_No response_

Claude Code Version

v1.0.127

Platform

Anthropic API

Operating System

Windows

Terminal/Shell

Windows Terminal

Additional Information

@@ -0,0 +1,133 @@

Bug Report: Claude CLI Path Duplication on Windows

Summary

Claude CLI incorrectly duplicates Windows drive paths when launched from certain directories, causing "Path was not found" errors and preventing the CLI from functioning.

Environment

  • OS: Windows 10/11
  • Claude CLI Version: Latest (as of Sept 2025)
  • Installation Method: npm global install
  • Shell: Occurs in Command Prompt, PowerShell, and Git Bash
  • Node Version: v20.17.0

Bug Description

When running claude -p from a directory on a non-C: drive (e.g., D:\dev2\addons), Claude incorrectly duplicates the path as D:\d\dev2\addons, resulting in the error message:

Path D:\d\dev2\addons was not found.

The CLI then hangs indefinitely, waiting for input that never arrives due to the path error.

Steps to Reproduce

  1. Open any terminal on Windows (cmd, PowerShell, or Git Bash)
  2. Navigate to a directory on a non-C: drive (e.g., D:\dev2\addons)
  3. Run: echo "test" | claude -p
  4. Observe the error: Path D:\d\dev2\addons was not found.
  5. The command hangs and never completes

Expected Behavior

Claude should correctly parse the path as D:\dev2\addons and execute the command without errors.

Actual Behavior

Claude duplicates the drive letter in the path (D:\d\dev2\addons), fails to find the directory, and hangs.

Reproducible Examples

Command Prompt

D:\dev2\addons>echo "test" | claude -p
Path D:\d\dev2\addons was not found.
[hangs indefinitely]

PowerShell

PS D:\dev2\addons> echo "test" | claude -p
Path D:\d\dev2\addons was not found.
[hangs indefinitely]

Git Bash

$ pwd
/d/dev2/addons
$ echo "test" | claude -p
Path D:\d\dev2\addons was not found.
[hangs indefinitely]

Workaround

Running Claude from the C: drive or user home directory avoids the bug:

C:\Users\username>echo "test" | claude -p
[works correctly]

Impact

This bug prevents Claude CLI from being used programmatically in scripts or automation tools when the working directory is on a non-C: drive. It affects:

  • Subprocess calls from Python/Node.js/etc.
  • Batch scripts and automation
  • CI/CD pipelines on Windows
  • Any programmatic use of claude -p for non-interactive operations

Root Cause Analysis

The bug appears to be in Claude's path resolution logic on Windows, where:

  1. The drive letter (e.g., D:) is incorrectly parsed
  2. The path is reconstructed with a duplicated structure (D:\d\)
  3. This malformed path causes file operations to fail

Suggested Fix

The path parsing logic needs to correctly handle Windows absolute paths with drive letters. The issue likely occurs when:

  • Converting between Windows and Unix-style paths
  • Resolving relative vs absolute paths
  • Handling the drive letter separator (:)

Related Issues

While searching for similar issues, we found several path-related bugs on Windows:

  • #4507: Git Bash path with spaces
  • #2602: Path conversion in Git Bash
  • #4079: Filesystem path resolution errors
  • #3461: Shell detection on Windows

However, this specific drive letter duplication bug has not been reported yet.

Additional Context

  • The bug occurs consistently across different shells
  • It only affects non-C: drives (D:, E:, etc.)
  • The path shown in the error has the pattern: [Drive]:\[drive_lowercase]\[rest_of_path]
  • This prevents any automation or scripting with Claude CLI on Windows when working directories are on secondary drives

Test Case

import subprocess
import os

# This fails with path duplication error
os.chdir("D:\\dev2\\addons")
result = subprocess.run(
    ["claude", "-p", "--output-format", "text"],
    input="What is 2+2?",
    capture_output=True,
    text=True
)
print(result.stderr)  # Shows: Path D:\d\dev2\addons was not found.

# This works (from C: drive)
os.chdir("C:\\temp")
result = subprocess.run(
    ["claude", "-p", "--output-format", "text"],
    input="What is 2+2?",
    capture_output=True,
    text=True
)
print(result.stdout)  # Shows: 4

Priority

High - This bug completely breaks Claude CLI functionality for Windows users working on non-C: drives, which is common in development environments with multiple drives for projects.

---

Repository: https://github.com/anthropics/claude-code
Issue Type: Bug
Labels: bug, windows, cli, path-handling, blocking

View original on GitHub ↗

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