claude-code - 💡(How to fix) Fix [BUG] \u in Windows path is interpreted as Unicode escape sequence, corrupting file paths for usernames starting with u followed by hex digits [2 comments, 3 participants]

Official PRs (…)
ON THIS PAGE

Recommended Tools

×6

Utilities matched from this issue’s tags and category — try them while you read without losing context.

GitHub issue graph ai analysis

Paste a GitHub issue URL. We fetch that issue, discover linked issues from bodies/comments/timeline, collect linked pull requests, and produce a structured English report.

The report is written in English Markdown for sharing and archival.

Helpful · Quick feedback

Loading…
GitHub stats
anthropics/claude-code#54583Fetched 2026-04-30 06:41:39
View on GitHub
Comments
2
Participants
3
Timeline
6
Reactions
0
Timeline (top)
labeled ×4commented ×2

Fix Action

Fix / Workaround

Workaround

RAW_BUFFERClick to expand / collapse

Preflight Checklist

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

What's Wrong?

Description

On Windows, when a username contains a sequence that looks like a Unicode escape (e.g. uabcdef), Claude Code corrupts the path in all file-related tool calls (Read, Write, Edit, Bash, Glob, Grep).

The backslash-u combination in C:\Users\uabcdef is silently interpreted as a Unicode escape sequence, producing a corrupted character in place of \ua — a path that does not exist.

Workaround

Building the path via a PowerShell intermediate variable avoids the issue:

$u = "uabcdef" $dest = "C:\Users$u\path\to\file.txt" [System.IO.File]::WriteAllText($dest, $content, [System.Text.Encoding]::UTF8)

POSIX-style paths in Bash (/c/Users/uabcdef/...) also work, but break when the file content contains single quotes (heredoc parsing issue).

Impact

Any Windows user whose username matches the pattern u[0-9a-fA-F]{4,} (common in corporate environments where usernames are employee IDs) is affected. All file tool calls silently target a non-existent path.

What Should Happen?

Expected behavior

The path C:\Users\uabcdef\file.txt should be passed as-is to the OS without any Unicode escape interpretation.

Actual behavior

C:\Users\uabcdef\file.txt is silently rewritten to a path containing a spurious Unicode character (e.g. U+0300 range), causing all file operations to fail with EPERM or File not found.

Steps to Reproduce

  1. Run Claude Code on Windows with a username that starts with u followed by 4–6 hexadecimal digits (e.g. uabcdef, u1a2b3c).
  2. Ask Claude to read, write, or edit any file under the user home directory.
  3. Observe that the tool call uses a corrupted path such as C:\Users[corrupted]bcdef... instead of C:\Users\uabcdef....

Claude Model

Sonnet (default)

Is this a regression?

Yes, this worked in a previous version

Last Working Version

na

Claude Code Version

2.1.121 (Claude Code)

Platform

Anthropic API

Operating System

Windows

Terminal/Shell

Other

Additional Information

Environment

  • OS: Windows 11 Enterprise 10.0.22631
  • Shell: Bash (Git Bash / MSYS2) — PowerShell also available
  • Claude Code version: latest CLI
  • Username pattern affected: any username matching u[0-9a-fA-F]{4,} (e.g. uabcdef)

extent analysis

TL;DR

The issue can be worked around by building the path via a PowerShell intermediate variable or using POSIX-style paths in Bash.

Guidance

  • The problem is caused by the interpretation of the backslash-u combination in Windows paths as a Unicode escape sequence, which can be avoided by using an intermediate variable in PowerShell.
  • To verify the issue, try running Claude Code on Windows with a username that starts with 'u' followed by 4-6 hexadecimal digits and observe the corrupted path used in file operations.
  • As a temporary workaround, use the PowerShell approach described in the issue to build the path, or use POSIX-style paths in Bash, although the latter may cause issues with single quotes in file content.
  • The root cause of the issue seems to be related to the handling of Unicode escape sequences in Windows paths, which was not present in previous versions of Claude Code.

Example

$u = "uabcdef"
$dest = "C:\Users\$u\path\to\file.txt"
[System.IO.File]::WriteAllText($dest, $content, [System.Text.Encoding]::UTF8)

Notes

The provided workaround using PowerShell intermediate variables seems to be a reliable solution, but the issue should be properly fixed in the Claude Code to handle Unicode escape sequences correctly.

Recommendation

Apply the workaround using PowerShell intermediate variables, as it provides a reliable solution to the issue until a proper fix is implemented in Claude Code.

Vote matrix · Quick signals

Works
Did the solution work? Tap to confirm.
Easy Fix
Was it a quick fix?
Time Saver
Did it save you time?
Blocking
Was it severely blocking?
Common Issue
Are others likely hitting this too?
Flaky / Intermittent
Is it intermittent?
Verified / Reproducible
Can you reproduce it reliably?
Loading…

Still need to ship something?

×6

Another batch ranked right after the header list — different links, same matching logic.

Back to top recommendations

TRENDING

claude-code - 💡(How to fix) Fix [BUG] \u in Windows path is interpreted as Unicode escape sequence, corrupting file paths for usernames starting with u followed by hex digits [2 comments, 3 participants]