claude-code - 💡(How to fix) Fix [BUG] Edit tool fails on files containing embedded Unicode PUA characters (Nerd Font glyphs) — falls back to PowerShell workaround unnecessarily

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…

Error Message

Error Messages/Logs

No error message. Just strange behavior requiring claude to edit using powershell script. Exception reporter ID: 27112418af3efe4-6098-40fb-bc6c-dc4d08efe6ce

Root Cause

Root cause (suspected): The Edit tool reads the file, finds PUA codepoints elsewhere in the surrounding context, and fails to round-trip them correctly during string comparison — causing the entire match to fail even when old_string itself contains no special characters.

Fix Action

Fix / Workaround


Regarding the Anthropic bug report — you can file it at https://github.com/anthropics/claude-code/issues. A good title would be: "Edit tool fails on files containing embedded Unicode PUA characters (Nerd Font glyphs) — falls back to PowerShell workaround unnecessarily". The core issue is that the Edit tool's string matcher doesn't round-trip Unicode PUA codepoints correctly when they appear anywhere in old_string, causing spurious "string not found" failures on otherwise valid matches.


Workaround used: [System.IO.File]::ReadAllLines / WriteAllLines in PowerShell with explicit UTF-8 encoding, which handles PUA codepoints correctly.

Code Example

No error message. Just strange behavior requiring claude to edit using powershell script.

  ---
  Regarding the Anthropic bug report — you can file it at https://github.com/anthropics/claude-code/issues. A good title would be: "Edit tool fails on files containing embedded Unicode PUA characters (Nerd Font glyphs) — falls back to PowerShell workaround unnecessarily". The core
   issue is that the Edit tool's string matcher doesn't round-trip Unicode PUA codepoints correctly when they appear anywhere in old_string, causing spurious "string not found" failures on otherwise valid matches.
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?

Specs

2.1.150 (Claude Code) JetBrains Rider Built-in Terminal Font: JetBrainsMonoNL NF

Description

The core issue is that the Edit tool's string matcher doesn't round-trip Unicode PUA codepoints correctly when they appear anywhere in old_string, causing spurious "string not found" failures on otherwise valid matches.

This was a very weird work around in Rider CLI....

What Should Happen?

Claude can edit csharp files using the default editor (with diff, etc...)

Error Messages/Logs

No error message. Just strange behavior requiring claude to edit using powershell script.

  ---
  Regarding the Anthropic bug report — you can file it at https://github.com/anthropics/claude-code/issues. A good title would be: "Edit tool fails on files containing embedded Unicode PUA characters (Nerd Font glyphs) — falls back to PowerShell workaround unnecessarily". The core
   issue is that the Edit tool's string matcher doesn't round-trip Unicode PUA codepoints correctly when they appear anywhere in old_string, causing spurious "string not found" failures on otherwise valid matches.

Steps to Reproduce

  1. Have a C# file that contains embedded Unicode PUA codepoints (e.g. Nerd Font glyphs in the U+E000–U+F8FF range) as string literals — for example inside a yield return statement in a method like BuildPaletteItems().
  2. Use the Edit tool with an old_string that targets a different line in the same method — one that contains no Unicode characters itself.
  3. Observe: Edit reports "string not found" even though the target line is plainly present and unique in the file.

Root cause (suspected): The Edit tool reads the file, finds PUA codepoints elsewhere in the surrounding context, and fails to round-trip them correctly during string comparison — causing the entire match to fail even when old_string itself contains no special characters.

Workaround used: [System.IO.File]::ReadAllLines / WriteAllLines in PowerShell with explicit UTF-8 encoding, which handles PUA codepoints correctly.

Repo context: ViewModels/MainViewModel.cs, method BuildPaletteItems(), which contains ~30 palette entries with embedded Nerd Font icon glyphs as string literals.

Claude Model

Sonnet (default)

Is this a regression?

I don't know

Last Working Version

No response

Claude Code Version

2.1.150 (Claude Code)

Platform

Anthropic API

Operating System

Windows

Terminal/Shell

Other

Additional Information

Rider Terminal

JetBrains Rider 2026.1.1 Build #RD-261.23567.144, built on April 23, 2026 Source revision: 484ee3a26185d

Runtime version: 25.0.2+1-b329.117 amd64137.0.17-261-b81

VM: OpenJDK 64-Bit Server VM by JetBrains s.r.o. Toolkit: sun.awt.windows.WToolkit Windows 10.0 Exception reporter ID: 27112418af3efe4-6098-40fb-bc6c-dc4d08efe6ce .NET Core v10.0.5 x64 (Server GC) GC: G1 Young Generation, G1 Concurrent GC, G1 Old Generation Memory: 4000M Cores: 12 Registry: debugger.watches.in.variables=false ide.lookup.shrink=true ide.experimental.ui=true rider.codeVision.fitToContent.enabled=true trace.state.event.service.url=https://api.jetbrains.cloud/trace-status rider.debugger.dotnet.mixed.mode.enabled=true find.in.files.split.actions=false find.in.files.split=false rider.codeVision.zeroWidth.preload.enabled=true Non-Bundled Plugins: org.jetbrains.completion.full.line (261.23567.182) Subversion (261.23567.176) com.intellij.plugins.riderkeymap (201.6251.22) com.intellij.plugin.adernov.powershell (2.11.0) com.tang (1.4.24-IDEA2026.1) io.github.stefansjs.flatbuffersplugin (0.5+31) com.anthropic.code.plugin (0.1.14-beta) mobi.hsz.idea.gitignore (4.5.7) com.intellij.resharper.StructuredLogging (2025.1.0.373) me.rafaelldi.aspire (2.5.3) avalonia-rider (1.11.0) com.devoxx.genie (1.4.3) com.github.jk1.ytplugin (2026.1) com.github.copilot (1.9.0-251) com.intellij.mcpServer (261.23567.174) com.intellij.resharper.azure (4.7.4)

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