google-gemini / google-gemini/gemini-cli
Bug: image paste fails in WSL2 when clipboard exposes image/bmp and XDG_SESSION_TYPE is unset
- Dominant language
- TypeScript
- Stars
- 107k
- Forks
- 14.6k
- Avg merge
- 2d 3h
- Merged PRs (30d)
- 45
Description
### What happened?
I am running Gemini CLI inside WSL2 Ubuntu on a Windows 11 host, launched from Windows Terminal.
When I copy an image on Windows and press `Alt+V` inside `gemini` running in WSL2, image paste fails.
After debugging, I found that in this WSL2 environment:
- `XDG_SESSION_TYPE` is unset
- `WAYLAND_DISPLAY=wayland-0`
- `DISPLAY=:0`
When an image is copied on Windows, the Linux clipboard side exposes `image/bmp` rather than `image/png`.
This suggests Gemini CLI's Linux clipboard image handling is not fully compatible with this WSL2 case.
### What did you expect to happen?
I expected `Alt+V` image paste to work in WSL2 when the clipboard contains an image.
Gemini CLI should ideally:
- detect the clipboard backend even when `XDG_SESSION_TYPE` is unset
- fall back to `WAYLAND_DISPLAY` / `DISPLAY` in WSL2-like environments
- accept the actual image MIME type exposed by `wl-paste` / `xclip`
- handle `image/bmp` gracefully, for example by converting it internally to PNG before attaching
### Client information
Client information
CLI Version: 0.33.1
Platform: Linux
OS: Ubuntu 24.04.3 LTS
Kernel: Linux momo 6.6.87.2-microsoft-standard-WSL2 #1 SMP PREEMPT_DYNAMIC Thu Jun 5 18:30:46 UTC 2025 x86_64 GNU/Linux
Sandbox Environment: no sandbox
Model Version: auto-gemini-3 (configured)
Selected Auth Type: oauth-personal
GCP Project: [not set]
IDE Client: [none]
User Email: ***@gmail.com
Additional environment:
- Host OS: Windows 11
- Terminal: Windows Terminal
- TERM=xterm-256color
- XDG_SESSION_TYPE is unset
- WAYLAND_DISPLAY=wayland-0
- DISPLAY=:0
Clipboard behavior observed during reproduction:
- When an image is copied on Windows, the Linux clipboard side exposes `image/bmp`
### Login information
Google Account login (`oauth-personal`)
### Anything else we need to know?
### Steps to reproduce
1. Copy an image into the Windows clipboard
2. Open Windows Terminal
3. Enter WSL2 Ubuntu
4. Run:
```bash
echo "XDG_SESSION_TYPE=$XDG_SESSION_TYPE"
echo "WAYLAND_DISPLAY=$WAYLAND_DISPLAY"
echo "DISPLAY=$DISPLAY"
wl-paste --list-types
5. Start Gemini CLI:
gemini
6. Press Alt+V
### Notes
A local compatibility patch that:
- falls back to WAYLAND_DISPLAY / DISPLAY when XDG_SESSION_TYPE is unset
- accepts image/bmp and converts it internally to PNG
made the same workflow work correctly in the same environment.
The same Windows clipboard image became attachable in the same WSL2 environment after that local compatibility patch. This makes the issue look like a Gemini CLI Linux/WSL
clipboard compatibility gap rather than a Windows clipboard bridge problem.
Contributor guide
Assessment
This issue has not been assessed yet.