[BUG] Claude Code Misinterprets <error> and <name> XML Tags When Reading Files
Bug Report:
Environment
- Platform (select one):
- [ ] Anthropic API
- [ ] AWS Bedrock
- [ ] Google Vertex AI
- [x] Other: Claude Code CLI
- Claude CLI version: 0.2.117
- Operating System: macOS Sequoia 15.4.1
- Terminal: iTerm
Bug Description
There's a bug in Claude Code where it incorrectly interprets XML tags when reading file contents. Specifically, it interprets <error> tags as <e> and <name> tags as <n>. As a result, Claude continuously suggests correcting the valid tags (<error>, <name>) and attempts various workarounds.
Steps to Reproduce
- Install and run Claude Code 0.2.117
- Create a file containing
<error>or<name>tags - Execute a file reading command in Claude Code
- Observe Claude's response to the file contents
Expected Behavior
Claude Code should correctly recognize and interpret the <error> and <name> tags in file contents exactly as they are.
Actual Behavior
Claude Code misinterprets <error> tags as <e> and <name> tags as <n>. This causes Claude to repeatedly suggest changing the tags to <error> and <name>, and it fails to properly process the original file contents.
Additional Context
This issue is particularly problematic when processing files that use XML or HTML tags. Claude's misinterpretation of these tags makes accurate parsing impossible, creating difficulties in understanding or modifying file contents correctly.
<result> becomes <r> too
This is an error on the chatbot version too, Claude doesn't have the capability to handle tags in XMLs correctly.
Hello, is anybody at anthropic paying attention to this? Every other context window I have to tell claude that it is hallucinating when it sees <n> instead of <name> when it is processing a pom.xml file. It wastes many tokens in the context window.
Is anybody there?
This issue has been inactive for 30 days. If the issue is still occurring, please comment to let us know. Otherwise, this issue will be automatically closed in 30 days for housekeeping purposes.