[BUG] WSL/WSLg: image paste fails because wl-paste returns BMP into a .png path
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?
On WSL2 with WSLg, pasting a Windows screenshot (ctrl+v or alt+v) always answers No image found in clipboard. Use ctrl+v to paste images.
The detection step is not the problem — it succeeds. checkImage falls back from xclip -t TARGETS to wl-paste -l, which reports image/bmp, and that matches the regex.
The failure is the format. saveImage runs its chain and the winning link is:
wl-paste --type image/bmp > <tmp>/claude_cli_latest_screenshot.png
WSLg publishes the Windows clipboard image only as image/bmp, so the file written to a .png path holds a BMP. It is rejected downstream, and the user sees No image found in clipboard.
The PowerShell fallback appended for WSL — which would have produced a real PNG — never runs, because the BMP link exited 0 before it was reached.
What Should Happen?
The screenshot should attach, as it does on other platforms.
Either fix would do:
- Convert on read — transcode to PNG when the winning link produced a BMP.
- Reorder for WSL — try the PowerShell PNG path before the
image/bmplinks when the platform iswsl, since it yields a directly usable PNG.
Error Messages/Logs
$ wl-paste -l
image/bmp
$ wl-paste --type image/png > /tmp/x 2>/dev/null; echo "exit=$?"
exit=1
$ wl-paste --type image/bmp > /tmp/x; file -b /tmp/x
PC bitmap, Windows 3.x format, 1920 x 1032 x 32
$ xclip -selection clipboard -t TARGETS -o
TIMESTAMP
TARGETS
UTF8_STRING
TEXT
# the data IS available as PNG on the Windows side, just not over Wayland:
$ powershell.exe -NoProfile -Command "...GetDataObject().GetFormats()"
System.Drawing.Bitmap, Bitmap, PNG, CanUploadToCloudClipboard, CanIncludeInClipboardHistory
Steps to Reproduce
- Run Claude Code inside WSL2 with WSLg, with
wl-clipboardinstalled. - On the Windows side, take a screenshot with
Win+Shift+Sso it lands on the Windows clipboard. - At the Claude Code prompt, press
ctrl+v(oralt+v). No image found in clipboard. Use ctrl+v to paste images.appears and nothing is attached.
Confirmation that only the format is at fault — put a real PNG on the Wayland clipboard and paste again:
wl-copy --type image/png < some.png
Both ctrl+v and alt+v then attach the image immediately, with no other change.
Claude Model
Opus
Is this a regression?
I don't know
Last Working Version
_No response_
Claude Code Version
2.1.241 (Claude Code)
Platform
Anthropic API
Operating System
Ubuntu/Debian Linux
Terminal/Shell
Windows Terminal
Additional Information
This replaces my original description of the same report, which had the cause wrong. I first blamed checkImage for lacking a wl-paste fallback; it has one, the chain is fine, and detection succeeds. The defect is that a BMP ends up in a file named .png.
Environment: WSL2 (kernel 6.18.33.2-microsoft-standard-WSL2), Ubuntu, wl-clipboard 2.2.1, xclip 0.13, Windows Terminal, WSLg active (WAYLAND_DISPLAY=wayland-0, DISPLAY=:0).
Feedback ID from the in-app report: fe517440-cbac-44ee-b945-56e51653bcfe
Workaround in use: a local wl-paste wrapper that serves image/png by transcoding the BMP with ffmpeg (~500 ms, against ~1.7 s for the PowerShell path) and advertises image/png in --list-types. Paste works normally with it in place.