Add image/bmp to Linux clipboard check for WSL2 image paste

Status Fixed / completed
Reported on v2.1.42
Maintainer reply None cached
Activity 6 comments · opened Feb 15, 2026 · closed Feb 16, 2026

Summary

Claude Code's Linux checkImage command excludes image/bmp from its grep pattern. This silently breaks image paste for all WSL2 users, because Windows copies images as BMP by default and WSLg forwards that format unchanged via Wayland.

A one-line fix would resolve this for every WSL2 user.

Root Cause

In cli.js, the Linux clipboard detection command is:

xclip -selection clipboard -t TARGETS -o 2>/dev/null \
  | grep -E "image/(png|jpeg|jpg|gif|webp)" \
  || wl-paste -l 2>/dev/null \
  | grep -E "image/(png|jpeg|jpg|gif|webp)"

image/bmp is missing from the pattern. When the clipboard contains BMP (the Windows default), checkImage returns exit code 1 and SD1() silently returns null — no error, no feedback.

Proposed Fix

Add bmp to the grep pattern:

- grep -E "image/(png|jpeg|jpg|gif|webp)"
+ grep -E "image/(png|jpeg|jpg|gif|webp|bmp)"

And add a BMP conversion path in saveImage (since the rest of the pipeline expects PNG):

wl-paste --type image/bmp 2>/dev/null | convert bmp:- png:"${TMPFILE}" 2>/dev/null

Or simply add BMP to the check and let ImageMagick/Sharp handle the conversion downstream.

Evidence

Tested on WSL2 (Ubuntu), Windows Terminal, Claude Code 2.1.42, Node v22.22.0:

| Command | Result |
|---------|--------|
| wl-paste -l | image/bmp (Windows default) |
| wl-paste --type image/bmp \| file - | Valid BMP image data |
| checkImage (as-is) | Exit 1 — grep misses image/bmp |
| checkImage (with bmp added) | Exit 0 |
| Manual BMP→PNG + Alt+V | Works perfectly |

The full checkImage → saveImage → base64 pipeline works once BMP is converted to PNG. The only failure point is the grep pattern.

Impact

This affects every WSL2 user who tries to paste images. WSL2 is a common developer environment, and this is the #1 reported image paste issue:

  • #13738 — Clipboard image paste not working in WSL (open, 13+ reports)
  • #1361 — Can't paste image from clipboard (open, 40+ comments)
  • #3150 — Cannot copy screenshots from WSL (closed, redirected)
  • #14635 — Clipboard Access Error in WSL2 (open)

Current Workaround

A background daemon (clip2png --watch) that polls the Wayland clipboard every 2 seconds and converts BMP→PNG via ImageMagick. Combined with a custom keybinding (alt+v → chat:imagePaste since Windows Terminal intercepts the default ctrl+v), this makes image paste work on WSL2. But it requires ImageMagick, a watcher script, Claude Code hooks, and custom keybindings — all to work around a missing format in a grep pattern.

Environment

  • Platform: WSL2 (Ubuntu) on Windows 11
  • Terminal: Windows Terminal
  • Claude Code: 2.1.42
  • Node: v22.22.0
  • Clipboard: WSLg Wayland (wl-paste/wl-copy)

View original on GitHub ↗

6 Comments

github-actions[bot] · 8 months ago

Found 3 possible duplicate issues:

  1. https://github.com/anthropics/claude-code/issues/13738
  2. https://github.com/anthropics/claude-code/issues/1361
  3. https://github.com/anthropics/claude-code/issues/3150

This issue will be automatically closed as a duplicate in 3 days.

  • If your issue is a duplicate, please close it and 👍 the existing issue instead
  • To prevent auto-closure, add a comment or 👎 this comment

🤖 Generated with Claude Code

ahmad-taha · 7 months ago

I am using the latest version of Claude Code (2.1.50) with Windows Terminal + VS Code + WSL2.

I have spent hours debugging and still can't get it to work. I even set up an Alt+V keybinding for imagePaste, and when I paste, I get the message: No image found in clipboard. Use alt+v to paste images.. I have tried it in both the VS Code terminal and the Windows Terminal app.

Notably, Claude Code can access the clipboard image through commands. Asking it to run wl-paste -l correctly returns image/bmp, and it can save and analyze the clipboard image. Also, I can paste images in Codex without any problems.

What am I missing here? It would make work so much easier if I was able to paste images inside Claude Code.

ZarifS · 7 months ago

@ahmad-taha facing the same issue as well - this fix doesn't seem to be working as intended on my machine on latest claude code version either.

Nailuu · 7 months ago

I built a CLI tool that solves this problem while waiting for them to fix this issue - wsl-screenshot-cli

Unlike other workarounds that hijack the clipboard, this tool preserves full Windows paste functionality. After taking a screenshot, your clipboard contains three formats simultaneously:

| Where you paste | What you get |
|---|---|
| WSL terminal (Ctrl+Shift+V) | File path -> Claude Code picks it up |
| Windows apps (Paint, Teams, Slack...) | The image, as usual |
| Explorer / file dialogs | The PNG file (paste-as-file) |

No broken clipboard. No choosing between WSL and Windows. Everything just works.

Quick Install

curl -fsSL https://raw.githubusercontent.com/Nailuu/wsl-screenshot-cli/main/scripts/install.sh | bash

Usage

Option 1 - Auto-start with your shell (add to ~/.bashrc):

wsl-screenshot-cli start --daemon

Option 2 - Auto-start/stop with Claude Code hooks (add to ~/.claude/settings.json):

{
  "hooks": {
    "SessionStart": [
      {
        "matcher": "",
        "hooks": [
          {
            "type": "command",
            "command": "wsl-screenshot-cli start --daemon 2>/dev/null; echo 'wsl-screenshot-cli started'"
          }
        ]
      }
    ],
    "SessionEnd": [
      {
        "matcher": "",
        "hooks": [
          {
            "type": "command",
            "command": "wsl-screenshot-cli stop 2>/dev/null"
          }
        ]
      }
    ]
  }
}

Then just take a screenshot and Ctrl+Shift+V in Claude Code - done.

ZarifS · 7 months ago

@Nailuu Bro this finally solved it - thank you so much it was super easy to setup. Only recommendation is also adding a auto entry for zshrc terminals. I can finally use images properly in WSL2.

github-actions[bot] · 7 months ago

This issue has been automatically locked since it was closed and has not had any activity for 7 days. If you're experiencing a similar issue, please file a new issue and reference this one if it's relevant.