[BUG] Large tool outputs containing Japanese text become corrupted and expand into fabricated lines on Windows
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?
When a tool returns a large amount of output containing multibyte characters (e.g. Japanese text) on Windows, the output becomes corrupted before it is shown to Claude.
The beginning of the output is usually correct, but partway through it is replaced by repeated filler tokens such as "...", "等", or "日本語コメント...", and the output expands to thousands of lines that do not exist in the original file. The reported output length can greatly exceed the actual file size and may ignore truncation limits.
This issue appears to affect the tool output relay/display layer rather than the underlying files themselves. File reads, writes, and edits remain correct, but the tool results returned to the model are corrupted.
The problem is reproducible with large outputs from tools such as Read, Grep, and Bash, while smaller outputs containing the same Japanese text are displayed correctly.
What Should Happen?
Tool outputs should be returned exactly as produced by the underlying command or file operation, regardless of output size or the presence of multibyte characters.
Large outputs containing Japanese or other Unicode text should remain intact, should not be replaced with filler content, and should not expand beyond the actual source content. Any configured truncation or output limits should be applied correctly and consistently.
Error Messages/Logs
Steps to Reproduce
- Use Claude Code on Windows.
- Open a repository containing source files with Japanese comments, docstrings, or other multibyte text.
- Run a tool that returns a large amount of text, for example:
Grepwith a large context range (e.g.-A 45or higher)Readon a wide line range- A Bash/PowerShell command that outputs a large file containing Japanese text
- Ensure the output is large enough that no additional manual truncation is applied.
- Observe the returned tool output.
Result:
- The beginning of the output is correct.
- Partway through, the content becomes corrupted and is replaced by repeated filler text such as
...,等, or日本語コメント.... - The output may expand to thousands of lines that do not exist in the source file.
- Requested output limits (e.g.
head_limit) may not be respected.
Control test:
- Repeat the same operation with a smaller output range.
- The Japanese text is displayed correctly and the corruption does not occur.
Claude Model
Opus
Is this a regression?
I don't know
Last Working Version
_No response_
Claude Code Version
Claude Code version: 2.1.153
Platform
Anthropic API
Operating System
Windows
Terminal/Shell
VS Code integrated terminal
Additional Information
Additional observations:
- The issue persists after a complete uninstall and reinstall of Claude Code.
- The issue is reproducible across multiple tools (Read, Grep, and Bash output), suggesting it is not tool-specific.
- File contents on disk remain correct. Only the tool output returned to Claude appears corrupted.
- Small outputs containing the same Japanese text render correctly.
- The corruption appears only after the output reaches a certain size threshold.
- The issue seems correlated with multibyte (Japanese) characters. Large outputs containing mostly ASCII text have not shown the same behavior so far.
- The corrupted output often contains repeated filler fragments such as:
...等日本語コメント...- The reported output length can greatly exceed the actual file length (e.g. a file with roughly 100 lines may be reported as having 2000+ lines).
- The generated lines do not exist in the original source file.
- As a workaround, limiting output size with
head_limit, smaller Read ranges, orhead/tailconsistently avoids the issue.
This issue has 2 comments on GitHub. Read the full discussion on GitHub ↗