[BUG] Citation tags incorrectly insert source information in the middle of quoted text

Open 💬 0 comments Opened Jun 12, 2026 by hachikou

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?

Description:

When using the citation system to cite web search results, the tags sometimes insert source metadata in the middle of the quoted content, breaking the text flow and rendering the citation tags incorrectly.

Problem Details:

The citation tag closes prematurely and unexpectedly introduces source information (like website names) in the middle of a sentence. This makes the output difficult to read and violates the proper citation formatting.

Example 1:
Incorrect output: "ペルー国内と海外を合わせて、合計336,060票..."
(The source information is inserted between "ペルー" and "国内")

Expected output: "ペルー国内と海外を合わせて、合計336,060票..."
(All text should be continuous without source interruption)

Example 2:
Incorrect: "開票作業は物理的な投票用紙を..."
Expected: "開票作業は物理的な投票用紙を..."
(The source information is inserted between "開" and "票")

Steps to Reproduce:

  1. Request a response that requires multiple web search citations
  2. Ask the assistant to cite source information using the tag system
  3. Observe that source metadata occasionally appears in the middle of quoted text instead of only in the tag attributes

Expected Behavior:

  • tags should only contain the quoted text, never broken mid-sentence
  • Source information should appear only in the index attribute: index="X-Y"
  • The citation should not interrupt the flow of the quoted text

Actual Behavior:

Source information (website names, metadata) appears between words in the quoted text, breaking the sentence and making it unreadable.

Severity: Medium
This issue affects readability and the quality of cited content. While the information is still present, the formatting makes it confusing.

What Should Happen?

Expected Behavior:

  • tags should only contain the quoted text, never broken mid-sentence
  • Source information should appear only in the index attribute: index="X-Y"
  • The citation should not interrupt the flow of the quoted text

Error Messages/Logs

Steps to Reproduce

Steps to Reproduce:

  1. Request a response that requires multiple web search citations
  2. Ask the assistant to cite source information using the tag system
  3. Observe that source metadata occasionally appears in the middle of quoted text instead of only in the tag attributes

Claude Model

Other

Is this a regression?

No, this never worked

Last Working Version

_No response_

Claude Code Version

v2.1.170

Platform

Anthropic API

Operating System

iOS

Terminal/Shell

Other

Additional Information

_No response_

View original on GitHub ↗