[BUG] Linux: JPEG clipboard image passes detection but saveImage only reads PNG/BMP, so Ctrl+V attaches nothing
Preflight Checklist
- [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?
On Linux, pasting an image that the clipboard offers only as image/jpeg fails with a one-second No image found in clipboard. Use ctrl+v to paste images. notice, even though the image is there.
This is not #8324 (missing xclip/wl-paste): xclip is installed, and the same image re-copied as image/png pastes fine. It is the same class of bug as #89223 (WSLg/BMP): the detection step and the read step disagree on which formats are supported.
In the bundled Linux clipboard commands (v2.1.285), checkImage accepts any of these types in TARGETS:
xclip -selection clipboard -t TARGETS -o | grep -E "image/(png|jpeg|jpg|gif|webp|bmp)" \
|| wl-paste -l | grep -E "image/(png|jpeg|jpg|gif|webp|bmp)"
saveImage only ever asks for two of them:
xclip -selection clipboard -t image/png -o > <tmp>.png \
|| wl-paste --type image/png > <tmp>.png \
|| xclip -selection clipboard -t image/bmp -o > <tmp>.png \
|| wl-paste --type image/bmp > <tmp>.png
With a JPEG-only clipboard, checkImage says "image present", every link of saveImage exits non-zero, the text fallback finds no text/plain, and the user gets "No image found". image/gif and image/webp hit the same gap. Browsers, some image viewers and messaging apps put JPEG-only images on the clipboard, so this is easy to hit.
What Should Happen?
Any type checkImage accepts should be readable. Either fix works:
- Extend the
saveImagechain withimage/jpeg,image/gifandimage/webplinks (writing the file with the matching extension, or transcoding to PNG). - Read whichever type matched in
checkImageand transcode that to PNG.
Fix 2 also covers #89223 (BMP bytes written into a .png path).
Steps to Reproduce
Put a JPEG-only image on the X11 clipboard:
magick -size 10x10 xc:red jpg:- | xclip -selection clipboard -t image/jpeg -i
xclip -selection clipboard -t TARGETS -o # -> image/jpeg, no image/png
- Press Ctrl+V in the Claude Code prompt. "No image found in clipboard" flashes, nothing attaches.
- Re-copy the same bytes as PNG and paste again:
xclip -selection clipboard -t image/jpeg -o | magick - png:- | xclip -selection clipboard -t image/png -i
Now Ctrl+V attaches the image.
Error Messages/Logs
No image found in clipboard. Use ctrl+v to paste images.
$ xclip -selection clipboard -t TARGETS -o
image/jpeg
TARGETS
MULTIPLE
TIMESTAMP
SAVE_TARGETS
$ xclip -selection clipboard -t image/png -o >/dev/null; echo exit=$?
exit=1
Environment
- Claude Code: 2.1.285 (native install,
~/.local/share/claude/versions/2.1.285) - OS: Manjaro Linux, kernel 6.12.108
- Session: X11 (
XDG_SESSION_TYPE=x11) - Terminal: kitty (
TERM=xterm-kitty) - Shell: zsh
xclip0.13 andxselinstalled;wl-pastenot installed (not needed on X11)
Related
- #8324 — Linux paste not working (missing clipboard tool). Different cause.
- #89223 — WSLg:
checkImagematchesimage/bmp,saveImagewrites BMP bytes into a.pngpath. Same detection/read mismatch.