Long tokens/strings get corrupted when pasted into chat
Bug Description
Long base64 strings (JWT tokens ~1600 chars) get silently corrupted when pasted into the Claude Code chat input. Individual characters are changed at random positions, making the token invalid without any visible indication to the user.
Steps to Reproduce
- Copy a long JWT token (~1623 characters) to clipboard
- Paste it into Claude Code chat as part of a message
- Compare the token Claude Code receives vs the original
Expected Behavior
The token should be received exactly as pasted, byte-for-byte identical.
Actual Behavior
Multiple characters are silently changed. In our case, we observed 4 different characters mutated at positions 176, 464, 868, and 1279 in a 1623-char JWT token. Examples:
- Position 176:
5→1 - Position 464:
5→1 - Position 868:
4→5 - Position 1279:
B→A
The corruption is not consistent — pasting the same token multiple times produced different corruptions each time.
Workaround
Writing the token to a file (temp_token.md) and having Claude Code read it via the Read tool preserves the token perfectly. Reading from file worked on the first try after hours of debugging chat-pasted tokens.
Impact
This caused ~1 hour of debugging where every API call failed with 403 Token cant be verified or 400 utf-8 codec can't decode byte. The token appeared correct visually but was silently corrupted. The corruption is invisible to both the user and Claude.
Environment
- macOS Darwin 24.6.0
- Claude Code CLI (Claude Opus 4.6)
- Token length: 1623 characters (standard JWT with 3 dot-separated base64 segments)
Verification
We confirmed the bug by:
- User pasted token into chat → 403 errors
- User saved same token to a file → Claude read file → token worked immediately
- Byte-by-byte comparison showed 4 character differences between chat version and file version
🤖 Generated with Claude Code
This issue has 3 comments on GitHub. Read the full discussion on GitHub ↗