[BUG] Pasting multi-line markdown into CLI silently drops/corrupts text chunks
Preflight
- [x] I have searched existing issues and this hasn't been reported yet
- [x] This is a single bug report
- [x] I am using the latest version of Claude Code
What's Wrong?
When pasting markdown text (30+ lines) into the Claude Code CLI prompt, chunks of text are silently dropped or corrupted. The corruption is deterministic — pasting the same content multiple times produces the same corruption in the same locations. However, different source texts produce corruption at different positions, suggesting it's position/length-dependent rather than tied to specific characters.
What Should Happen?
Text pasted into the CLI should arrive character-for-character identical to what was copied to the clipboard. We verified via pbcopy/pbpaste that the clipboard contents are correct — the corruption happens between the paste event and what Claude receives as input.
Steps to Reproduce
- Save this file as
/tmp/test-paste.md:
You are a helpful assistant reviewing a shopping list. Be thorough.
**FORMAT:** Each item needs a name and quantity.
**RULES:** Group similar items together. If an item spans two categories, split it.
**Per item:**
- **What:** The item to buy.
- **Quantity:** How many to get
- **Notes:** Any special instructions, isn't decided, or needs checking at store
**My starting draft (challenge as needed):**
1. Bread — whole wheat, sliced
2. Milk — 2%, one gallon
3. Eggs — free range, one dozen
4. Chicken — boneless skinless breasts, about two pounds
5. Rice — basmati, five pound bag
6. Onions — yellow, about three pounds
7. Tomatoes — roma, one pound
8. Olive Oil — extra virgin, one bottle
9. Garlic — one bulb (or pre-minced jar if available)
10. Pasta — penne, one box
11. Cheese — sharp cheddar block
12. Apples — honeycrisp or fuji, about six (e.g., new seasonal variety at farmers market creates better option)
13. Bananas — one bunch
14. Greek Yogurt
**Work interactively:**
0. Challenge the list first — is anything missing or wrong?
1. Suggest better alternatives if any exist
2. Group items by store section
3. Present items for review — don't finalize without input
- Open the file in an editor, Select All, Copy.
- Paste into the Claude Code CLI prompt and send.
- Ask Claude to compare what it received against the source file.
Observed corruption with this file:
- Source line:
0. Challenge the list first — is anything missing or wrong? - Received by Claude:
0. is anything missing or wrong? - The text
Challenge the list first —was silently dropped.
Additional reproduction notes:
We also tested with a longer (~39 line) markdown document. That document had TWO corruption sites per paste, and the corruption was identical across multiple pastes of the same content:
- Corruption 1:
or needs POC/researcharrived asords POC/research - Corruption 2: A line ending with a two-word phrase, followed by a blank line, followed by
**Work interactively:**was collapsed into a garbled mix of the phrase ending and the bold header:[corrupted] interactively:**
What did NOT reproduce: A short (11-line) markdown file with similar structure (numbered list followed by **bold header:**) pasted without corruption. This suggests the bug is length/position-dependent — short pastes survive, longer pastes get corrupted.
Error Messages/Logs
No error messages — the corruption is silent. Claude receives mangled input with no indication that anything went wrong.
Claude Model
Opus
Is this a regression?
I don't know
Claude Code Version
2.1.37 (Claude Code)
Platform
Anthropic API
Operating System
macOS 26.2 (Tahoe), Apple Silicon (arm64)
Terminal/Shell
Cursor IDE integrated terminal (reports as vscode v2.4.28 via $TERM_PROGRAM), zsh
Additional Information
- Node.js v24.4.1
- The clipboard itself is not corrupted — verified by
cat file | pbcopy && pbpastewhich round-trips perfectly. - The corruption is deterministic: same source text → same corruption locations → same mangled output, across multiple paste attempts.
- Shorter documents (~11 lines) with the same structural patterns paste correctly. The bug appears to require a minimum text length to trigger.
---
This issue was authored by Claude Code (Opus 4.6) during a debugging session with the user.
This issue has 6 comments on GitHub. Read the full discussion on GitHub ↗