[BUG] claude is reading certain tags in files wrong (<Name> being read as <n>) breaking its edits

Resolved 💬 8 comments Opened Mar 16, 2025 by inigohidalgo Closed Jan 4, 2026

Environment

  • Platform (select one):
  • [X] Anthropic API
  • Claude CLI version: 0.2.45 (Claude Code)
  • Operating System:macos
  • Terminal: VSCode terminal and iTerm2, behavior happens in both

Bug Description

Claude is running into issues editing files that contain a <Name>{name}</Name> tag. When reading those files it seems to be replacing the text with <n>{name}</n>.

It gets stuck trying to change that back, trying in many different ways, grep, sed, etc. And wastes time, credits and context.

Logs


  Now let's update the Header component to implement the collapsible contact section for mobile view:

⏺ Update(file_path: //src/components/Header.tsx)…
  ⎿  String to replace not found in file.

⏺ I need to fix the code in line 88 where there's a typo in the component name. Let's try again:

⏺ Read(file_path: "/src/components/Header.tsx", limit: 10, offset:…
      80)
  ⎿  /**
      * Header component that displays the CV owner's name, title, and contact details
      * Responsive design ensures proper display on both mobile and desktop
      */
     const Header: React.FC<HeaderProps> = ({ name, title, contact }) => {
       return (
         <HeaderContainer>
           <HeaderContent>
             <Name>{name}</Name>
             <Title>{title}</Title>

⏺ I see the issue - there's an HTML tag <n> instead of the <Name> component. Let me fix that and redo the edit:

⏺ Update(file_path: /src/components/Header.tsx)…
  ⎿  String to replace not found in file.

⏺ Let me try another approach - let's read the exact file content and then make the updates:

⏺ Bash(cat -n /src/components/Header.tsx)…
  ⎿  No (tell Claude what to do differently)

Line 88 at the time was <Name>{name}</Name>

⏺ Read(file_path: "/docs/planning/style-overhaul/250316-text-styling-consistency-implementation-steps.md", offset: 165, …
      limit: 20)
  ⎿      text-align: left;
         // Remove the custom font-size override
         max-width: 40%;
         word-break: break-word;
         hyphens: auto;
       }
     `;
     ```

     4. Check for any other occurrences of custom font sizes in the file and replace them with the appropriate typography system styles
     5. Fix any issues with the HTML elements in the component to ensure semantic correctness, particularly checking the component render method to confirm h1 tags are used
     correctly
     6. Look for the line `<n>{name}</n>` near line 120 and fix it to `<Name>{name}</Name>` (this appears to be a typo in the current code)
     7. Save the file

     8. **Commit these changes with the message**:
     ```
     fix(header): improve header text sizing for mobile view

     - Update Name component to use semantic h1 style with improved mobile sizing
     - Remove custom font-size overrides in favor of typography system values

⏺ Update(file_path: /docs/planning/style-overhaul/250316-text-styling-consistency-implementation-steps.md)…
  ⎿  String to replace not found in file.

⏺ This is strange. Let me try to view the actual file contents:

  Bash(grep -n "<n>" /docs/planning/style-overhaul/250316-text-styling-consistency-implementation-steps.md)…

View original on GitHub ↗

This issue has 8 comments on GitHub. Read the full discussion on GitHub ↗