Ctrl+V image paste shows no placeholder on Wayland despite successful clipboard read

Resolved 💬 12 comments Opened Oct 6, 2025 by MasterMind7777777 Closed Nov 10, 2025
💡 Likely answer: A maintainer (MasterMind7777777, contributor) responded on this thread — see the highlighted reply below.

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

  1. Launch Codex TUI on a native Wayland terminal (kitty Wayland backend).
  2. Copy a PNG (I used a fresh screenshot).
  3. Focus the composer and press Ctrl+V.
  4. 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_image or PasteImageError entries appear in ~/.codex/log/codex-tui.log.

View original on GitHub ↗

12 Comments

PaulFidika · 9 months ago

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 contributor · 9 months ago

@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 · 9 months ago

I can confirm that pasting on Wayland hasn't worked for me in any previous versions (0.44 or earlier).

donnielrt · 9 months ago

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!

<img width="411" height="169" alt="Image" src="https://github.com/user-attachments/assets/c439e372-c5f6-48e8-9a43-8610408e2438" />

<img width="1023" height="176" alt="Image" src="https://github.com/user-attachments/assets/18a723a6-da41-4f19-ab0e-b79528e1c442" />

ak127a · 9 months ago

+1.
Does not work for me.
On CachyOS with Niri and Kitty

sgeier · 8 months ago

Just pasting an image without the placeholder showing still does not provide the image to the context. I tried this here twice.

<img width="931" height="1016" alt="Image" src="https://github.com/user-attachments/assets/6fae6f7b-5f06-4b93-a045-b229b928d5f8" />

MasterMind7777777 contributor · 8 months ago
Just pasting an image without the placeholder showing still does not provide the image to the context. I tried this here twice. <img width="931" height="1016" alt="Image" src="https://github.com/user-attachments/assets/6fae6f7b-5f06-4b93-a045-b229b928d5f8" />

If there is no placeholder that means that image failed to be processed and was not added to context.

dolzenko · 3 months ago

Reproduced on Arch Linux / Wayland / Alacritty with codex-cli 0.118.0.

The clipboard contains a valid image (wl-paste --list-types shows image/png, and extracting it produces a valid 1920x1014
PNG), but pasting into Codex TUI does nothing: no placeholder, no attachment, no visible error.

disable_paste_burst = true is already enabled, so this does not seem to be the known text paste burst issue. This looks
specifically like missing/broken Wayland clipboard image attachment support in the TUI.

MasterMind7777777 contributor · 3 months ago

@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 · 3 months ago
@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?

George, thank you! It was something in my alacritty config, it indeed works with default one.

dolzenko · 3 months ago
@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?

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 contributor · 3 months ago
> @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? 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."

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.