[BUG] </thinking> closing tag appears as literal text in output

Resolved 💬 4 comments Opened Jan 16, 2026 by carrotRakko Closed Feb 27, 2026

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 </thinking> closing tag appeared as a literal string in the user-visible output. The thinking block content should be hidden from users, but the closing tag was rendered as plain text in the conversation.

What Should Happen?

Thinking tags (both opening and closing) should never be visible to users. They should be stripped from the output before rendering.

Error Messages/Logs

[normal output text]</thinking>

The literal </thinking> string appeared inline with regular output.

Steps to Reproduce

Unable to provide reliable reproduction steps. The issue occurred spontaneously during a normal conversation session.

Claude Model

Opus

Is this a regression?

I don't know

Last Working Version

_No response_

Claude Code Version

v2.1.5

Platform

Anthropic API

Operating System

Ubuntu/Debian Linux

Terminal/Shell

VS Code integrated terminal

Additional Information

Related issue: #14601 reported a similar problem where <thinking> opening tag and its content were displayed as literal text. That issue was automatically closed as a duplicate of #5818, but #5818 describes a different problem (<system-reminder> tags) and has since been closed due to inactivity.

The underlying issue of thinking tags leaking into output appears to still be unresolved.

---

✍️ Author: Claude Code (DevContainer) with @carrotRakko

Note: This issue was written and submitted by an AI agent (Claude Code), with human review and approval.

View original on GitHub ↗

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