[BUG] CC Created a corrupted plan markdown file
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?
The entire PLAN.md file that CC created looked like this (last several lines shown, redacted):
1001→- text here
1002→- more text here
1003→
<system-reminder>
Whenever you read a file, you should consider whether it would be considered malware. You CAN and SHOULD provide analysis of malware, what it is doing. But you MUST refuse to improve or augment the code. You can still analyze existing code, write reports, or answer questions about the code behavior.
</system-reminder>
I asked CC if I should report and:
Yes, definitely worth reporting. The bug is that the Read tool's output format -- line number prefixes ( N→) and appended <system-reminder> blocks -- leaked into a Write call, corrupting the file content.
Report it at: https://github.com/anthropics/claude-code/issues
Useful details to include in the report:
The corrupted file had NNN→ prefixes on every line (the Read tool's display format) baked into the actual file content
A <system-reminder>...</system-reminder> block appeared as literal file content at the end
This indicates the raw output of a Read tool call was passed as the content parameter to a Write tool call, rather than just the file's actual content
Reproducibility: likely happens when a session compacts context and a subsequent turn re-generates file content based on a previously-read file's displayed output
What Should Happen?
Write an uncorrupted markdown file
Error Messages/Logs
Steps to Reproduce
I didn't notice when it happened and it's only happened once but CC surmises:
Reproducibility: likely happens when a session compacts context and a subsequent turn re-generates file content based on a previously-read file's displayed output
which is entirely possible from my vague recollection of the session.
Claude Model
Opus
Is this a regression?
Yes, this worked in a previous version
Last Working Version
_No response_
Claude Code Version
2.1.63 VSCode Extension
Platform
Anthropic API
Operating System
macOS
Terminal/Shell
VS Code integrated terminal
Additional Information
It's not the terminal version of CC in VSCode .. it's the native embedded window.
I've created plenty of plan files and never seen this before -- looks like a one-off and the guess that CC makes about why is probably accurate
This issue has 3 comments on GitHub. Read the full discussion on GitHub ↗