Repository navigation
Description
What feature would you like to see?
Problem
In the TUI, pressing Ctrl+V after copying a PNG succeeds according to the
paste_image_as_png span, yet the composer never shows the [image …] placeholder and no
image is attached. There’s also no user-visible error.
Steps to Reproduce
- Launch Codex TUI on a native Wayland terminal (
kittyWayland backend). - Copy a PNG (I used a fresh screenshot).
- Focus the composer and press
Ctrl+V. - Observe that nothing appears; retrying yields the same result.
Expected
An image placeholder should appear in the composer, just as it does on X11 terminals.
Actual
The log shows the clipboard read finishing successfully, yet the composer stays unchanged
and no attach_image entries appear. Because the Ctrl+V handler ignores the Err from
paste_image_to_temp_png(), any failure in that helper is swallowed, leaving the paste
as a silent no-op. Please add Wayland-safe image paste support and surface the failure so
users know what happened.
Silent error
The Ctrl+V handler in codex-rs/tui/src/chatwidget.rs:1015-1035 calls
paste_image_to_temp_png() inside if let Ok((path, info)) = paste_image_to_temp_png().
Because the Err branch is never matched, any failure immediately exits the handler
without logging or UI feedback. The helper (codex-rs/tui/src/clipboard_paste.rs:121-135)
does return detailed PasteImageError::IoError/NoImage/..., but since the caller ignores
the Err, those messages never reach the log or the user, so the paste simply appears to
do nothing.
// codex-rs/tui/src/chatwidget.rs:1015-1035
KeyEvent {
code: KeyCode::Char('v'),
modifiers: KeyModifiers::CONTROL,
kind: KeyEventKind::Press,
..
} => {
if let Ok((path, info)) = paste_image_to_temp_png() {
self.attach_image(path, info.width, info.height, info.encoded_format.label());
}
return;
}paste_image_to_temp_png() returns a Result, but only the Ok branch is handled. Any Err
immediately returns from handle_key_event with no log or UI feedback.
// codex-rs/tui/src/clipboard_paste.rs:121-134
pub fn paste_image_to_temp_png() -> Result<(PathBuf, PastedImageInfo), PasteImageError> {
let (png, info) = paste_image_as_png()?;
let tmp = Builder::new()
.prefix("codex-clipboard-")
.suffix(".png")
.tempfile()
.map_err(|e| PasteImageError::IoError(e.to_string()))?;
std::fs::write(tmp.path(), &png).map_err(|e| PasteImageError::IoError(e.to_string()))?;
let (_file, path) = tmp
.keep()
.map_err(|e| PasteImageError::IoError(e.error.to_string()))?;
Ok((path, info))
}The helper maps failures to PasteImageError, but because the caller discards
the Err branch, every error path becomes a silent no-op, so nothing reaches the logs or
the user.
Additional information
- Codex CLI: 0.44.0
- OS: Arch Linux (Wayland session; DISPLAY=:0, WAYLAND_DISPLAY=wayland-1)
- Terminal: kitty 0.43.1 (Wayland backend)
- TMPDIR: /tmp (default)
- Repro: copy a PNG screenshot → focus Codex → press Ctrl+V → nothing appears
- Log snippet (ANSI stripped):
2025-10-06T11:11:43.261773Z DEBUG paste_image_as_png: attempting clipboard image read
2025-10-06T11:11:43.263943Z DEBUG paste_image_as_png:get_image: close time.busy=505µs time.idle=11.1µs
2025-10-06T11:11:43.264248Z DEBUG paste_image_as_png: close time.busy=2.47ms time.idle=9.65µs- Note: no subsequent
attach_imageorPasteImageErrorentries appear in~/.codex/log/codex-tui.log.
- Note: no subsequent
Activity
PaulFidika commentedon Oct 10, 2025
Same; paste no longer works (I'm on Ubuntu). The bug was introduced in 0.45; I reverted to v0.44 which does not have this issue.
MasterMind7777777 commentedon Oct 13, 2025
@PaulFidika Are you on wayland or x11? I was not working for me even on 0.44 so there could another problem that prevents pasting image.
donnielrt commentedon Oct 13, 2025
I can confirm that pasting on Wayland hasn't worked for me in any previous versions (0.44 or earlier).
donnielrt commentedon Oct 16, 2025
For anybody struggling with the lack of image support in the linux codex CLI, I just found a workaround online to this that solves the problem perfectly! While paste (Cmd+V/Ctrl+V) isn't working, dragging and dropping an image into the terminal works!
ak127a commentedon Oct 17, 2025
+1.
Does not work for me.
On CachyOS with Niri and Kitty
sgeier commentedon Nov 1, 2025
Just pasting an image without the placeholder showing still does not provide the image to the context. I tried this here twice.
MasterMind7777777 commentedon Nov 1, 2025
If there is no placeholder that means that image failed to be processed and was not added to context.
Fix wayland image paste error (openai#4824)
Fix wayland image paste error (openai#4824)
dolzenko commentedon Apr 6, 2026
Reproduced on Arch Linux / Wayland / Alacritty with codex-cli 0.118.0.
The clipboard contains a valid image (
wl-paste --list-typesshowsimage/png, and extracting it produces a valid 1920x1014PNG), but pasting into Codex TUI does nothing: no placeholder, no attachment, no visible error.
disable_paste_burst = trueis already enabled, so this does not seem to be the known text paste burst issue. This looksspecifically like missing/broken Wayland clipboard image attachment support in the TUI.
MasterMind7777777 commentedon Apr 6, 2026
@dolzenko checked just now paste works for me on 0.118.0 on arch wayland, but i'm on kitty.
You might wanna check in .codex/log/codex-tui.log
What does it say as you press Ctrl+V?
dolzenko commentedon Apr 7, 2026
George, thank you! It was something in my alacritty config, it indeed works with default one.
dolzenko commentedon Apr 7, 2026
Is it true that codex cli is handling Ctrl+V only as image paste relying on terminal to handle text pastes? Because I think this might be the issue. When buffer has text and Ctrl+V reaches codex I get " Failed to paste image: no image on clipboard: The clipboard contents were not available in the requested format or the clipboard is empty."
MasterMind7777777 commentedon Apr 20, 2026
It handles Ctrl+v directly as key handler. I have same issue when pasting text.
To paste text I use Ctrl+Shift+V it bypasses key listener.
Fix wayland image paste error (openai#4824)