[BUG] Code blocks silently drop lines containing certain XML tags (rendering + copy code)
What's Wrong?
Fenced code blocks in the chat silently drop lines containing certain XML tags. The lines are missing both from the on-screen rendering and from the output of the "copy code" button. The underlying content generated by the model is correct — when the assistant writes the same snippet to a file on disk, the file is complete, valid XML — so this is purely a rendering/clipboard issue in the app.
This makes the app return non-wellformed XML for common tasks (e.g. Maven pom.xml snippets), and is very confusing to debug: the model sees its own output as valid, while the user sees and copies garbage.
What Should Happen?
Every line of a fenced code block should render on screen and be included in the "copy code" clipboard output, regardless of whether the line looks like an HTML/XML tag.
Steps to Reproduce
- In Claude for Windows, ask the assistant to output this Maven snippet in a fenced ```xml code block:
``xml``
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-source-plugin</artifactId>
<version>3.3.1</version>
<executions>
<execution>
<id>attach-sources</id>
<goals>
<goal>jar-no-fork</goal>
</goals>
</execution>
</executions>
</plugin>
- Look at the rendered code block and/or click the "copy code" icon and paste the clipboard contents.
Actual result: two lines are missing — <goals> and <goal>jar-no-fork</goal> — while the closing </goals> line remains, so the block renders as:
<id>attach-sources</id>
</goals>
Notes:
- HTML-entity-escaped versions of the same lines (
<goals>) render correctly, suggesting the code-block renderer is HTML-sanitizing tag-like text instead of treating it as literal code. - Reproduced consistently across multiple messages in the same session.
- Screenshot showing the truncated rendering next to the app version: see comment below.
- This appears to be a recurring bug, previously reported with other tag names (e.g.
<context>) in #70613, #31635 and #43581 — all closed for inactivity rather than fixed. Filing fresh since it still reproduces on current version.
Is this a regression?
I don't know.
Claude Code Version
Claude for Windows (desktop app) Version 1.21459.0 (f7518f). Update to 1.21459.3 was pending at the time of reporting.
Claude Model
claude-sonnet-5 and claude-fable-5 (bug is in the app's rendering, not model output — file written to disk by the model is correct).
Platform
Anthropic API
Operating System
Windows 11 Enterprise 10.0.26200
Terminal/Shell
Not applicable — Claude for Windows desktop app chat UI.
3 Comments
<img width="1918" height="1078" alt="Image" src="https://github.com/user-attachments/assets/dfd59174-2f1b-427b-9304-e517a6cce329" />
This is the screenshot. Bug is initially posted by Fable 5 on Claude for Windows using gh CLI which it says cannot attach images
Found 3 possible duplicate issues:
This issue will be automatically closed as a duplicate in 3 days.
🤖 Generated with Claude Code
The bugs mentioned in the above list are closed for inactivity.
I don't know how it happens, why not many more people encounter it, but it's real and very annoying.
Seems like some tags
<goals>in my case,<context>mentioned in other bugs, are silently stripped in output.So when I ask an advice about a Java Maven plugin, I get non-wellformed XML and when I ask Claude about it, it doesn't get what I'm asking about - for it the XML is valid, but when I copy it or look at it, it's garbage