[BUG] "Add to context" duplicates selected text multiple times in input box

Resolved 💬 2 comments Opened Apr 27, 2026 by RussVibecode247 Closed May 30, 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?

When selecting text in a Claude Code response and using "Add to context" (or "Attach selection as context"), the selected text is inserted into the input box multiple times instead of once. Each subsequent selection adds to the duplication, creating compounding bloat that has to be manually deleted before sending.

<img width="845" height="655" alt="Image" src="https://github.com/user-attachments/assets/e8eb7684-64ca-4c0f-9d00-38912d6d20c5" />
<img width="1863" height="358" alt="Image" src="https://github.com/user-attachments/assets/c095577c-afa7-4a9c-9e3d-93a22dd148ee" />

<img width="1328" height="890" alt="Image" src="https://github.com/user-attachments/assets/ad6e9d1a-68be-40ba-9b17-6d2f7409638f" />

What Should Happen?

Selected text appears in the input box once, formatted as a quoted/referenced block.

Actual Behavior

Selected text appears multiple times (often 2-3+ duplicate blocks of the same content) in the input box. Each new selection compounds the issue. To send a clean message, the user has to manually delete the duplicates first.

Impact

  • Token waste: every duplicate block consumes context tokens unnecessarily
  • Workflow disruption: extra delete-step before every send
  • Especially severe for users on token-capped tiers (Claude Max): this directly burns paid-tier capacity on duplicated content

Screenshot

[Attach the screenshot showing the duplicate-paste behavior in the input box]

<img width="1328" height="890" alt="Image" src="https://github.com/user-attachments/assets/b7c5a194-b07f-4751-8c6e-072ebf161478" />

<img width="845" height="655" alt="Image" src="https://github.com/user-attachments/assets/dcbff05c-a3c2-46a1-959f-aeb97c7a6d32" />

Error Messages/Logs

Steps to Reproduce

Reproduction Steps

  1. Have any Claude response visible in the conversation
  2. Highlight a passage of text within the response
  3. Right-click the selection → choose "Attach selection as context" (or "Add to context")
  4. Observe the input box

Expected Behavior

Selected text appears in the input box once, formatted as a quoted/referenced block.

Actual Behavior

Selected text appears multiple times (often 2-3+ duplicate blocks of the same content) in the input box. Each new selection compounds the issue. To send a clean message, the user has to manually delete the duplicates first.

Impact

  • Token waste: every duplicate block consumes context tokens unnecessarily
  • Workflow disruption: extra delete-step before every send
  • Especially severe for users on token-capped tiers (Claude Max): this directly burns paid-tier capacity on duplicated content

Screenshot

[Attach the screenshot showing the duplicate-paste behavior in the input box]

Claude Model

Opus

Is this a regression?

No, this never worked

Last Working Version

_No response_

Claude Code Version

4.7 Opus

Platform

Anthropic API

Operating System

Windows

Terminal/Shell

Terminal.app (macOS)

Additional Information

Environment

  • Claude Code version: [version from claude --version if you can grab it]
  • OS: Windows 11
  • Plan: Claude Max
  • Reproducibility: 100% — happens on every selection-to-context action

Workaround

Currently the only workaround is manually deleting duplicate blocks from the input before pressing send. Cumulative across many sends, this is meaningful friction.

View original on GitHub ↗

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