[BUG] chat:imagePaste` text fallback double-pastes in Ghostty terminal when bound to cmd+v; please make the fallback optional
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?
Summary
chat:imagePaste now pastes the clipboard text when the clipboard holds no image (telemetry label input_image_paste / text_fallback). In Ghostty terminal on macOS this makes any user binding of cmd+v to chat:imagePaste paste text twice, because Ghostty both performs its own paste and forwards Cmd+V to Claude Code as a Kitty keyboard protocol keypress. Before the fallback existed, that binding was the standard way to get Cmd+V image paste in Ghostty and worked cleanly: no image → nothing happened.
Environment
- Claude Code 2.1.280 (also reproduced on 2.1.277 and 2.1.278; all three contain the
text_fallbackpath) - Ghostty 1.3.1, macOS 26 (Darwin 27.0), Apple Silicon
~/.claude/keybindings.json:
``json``
{ "bindings": [ { "context": "Chat", "bindings": { "cmd+v": "chat:imagePaste" } } ] }
Steps to reproduce
- Use the keybinding above.
- Start
claudein Ghostty terminal. - Copy any text, press Cmd+V in the prompt.
Expected
Text is pasted once. With an image on the clipboard, the image is pasted.
Actual
Text is pasted twice. Images paste correctly (only the keypress path runs, since Ghostty has no text to paste).
With the binding removed, Cmd+V pastes text once but a stray v appears at the end, because the forwarded Cmd+V keypress is treated as typed input.
Why this happens
- Ghostty forwards Cmd+V to Kitty-protocol applications as
ESC [ 118 ; 9 uin addition to its own paste (ghostty-org/ghostty#12406, #11444, both closed "not planned"), so Claude Code receives a bracketed paste and acmd+vkey event. - The
cmd+vbinding runschat:imagePaste, which finds no image and falls back to pasting the clipboard text: second paste.
Request
Any one of these would fix it:
- A setting or env var to disable the text fallback in
chat:imagePaste(image only, do nothing when there is no image), or a separate action such aschat:imagePasteOnly. - Dedupe: skip the text fallback if a bracketed paste with identical content arrived within the last ~100 ms.
- Ignore an unbound
cmd+vkey event instead of insertingv, so users can at least bind it to nothing without a stray character.
Option 1 is the smallest change and restores the previous behaviour for people who opted into the binding.
Workaround I'm using
cmd+v → app:redraw (no-op) in keybindings.json, plus a Hammerspoon event tap that rewrites Cmd+V to Ctrl+V in Ghostty only when the clipboard contains an image.
What Should Happen?
Cmd+V pastes the clipboard text once. With an image on the clipboard, the image is pasted.
Error Messages/Logs
Steps to Reproduce
- Add to ~/.claude/keybindings.json:
{ "bindings": [ { "context": "Chat", "bindings": { "cmd+v": "chat:imagePaste" } } ] } - Start
claudein Ghostty 1.3.1 on macOS. - Copy any text, press Cmd+V in the prompt: the text is pasted twice.
- Remove the binding, press Cmd+V again: the text is pasted once with a stray "v" appended.
Claude Model
None
Is this a regression?
Yes, this worked in a previous version
Last Working Version
Unknown; broken in 2.1.277, 2.1.278 and 2.1.280 (all contain the text_fallback path)
Claude Code Version
2.1.280 (Claude Code)
Platform
Anthropic API
Operating System
macOS
Terminal/Shell
Other
Additional Information
Terminal: Ghostty 1.3.1.
The same keybinding in Terminal.app is unaffected, since Terminal.app has no Kitty keyboard protocol and Cmd+V never reaches Claude Code.