claude-code icon indicating copy to clipboard operation
claude-code copied to clipboard

[BUG] Claude Code Misinterprets <error> and <name> XML Tags When Reading Files

Open tim-watcha opened this issue 7 months ago • 2 comments

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

  1. Install and run Claude Code 0.2.117
  2. Create a file containing <error> or <name> tags
  3. Execute a file reading command in Claude Code
  4. 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.

tim-watcha avatar May 18 '25 14:05 tim-watcha

<result> becomes <r> too

tim-watcha avatar May 18 '25 15:05 tim-watcha

This is an error on the chatbot version too, Claude doesn't have the capability to handle tags in XMLs correctly.

ronlu-o avatar Jun 08 '25 05:06 ronlu-o

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?

kevinhagel avatar Aug 31 '25 14:08 kevinhagel

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.

github-actions[bot] avatar Dec 05 '25 10:12 github-actions[bot]