Skip to content

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

Closed

Description

@MasterMind7777777

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.

Activity

  1. added
    enhancement
    on Oct 6, 2025
  2. added
    bug
    on Oct 6, 2025
  3. PaulFidika commented on Oct 10, 2025

    @PaulFidika

    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.

  4. MasterMind7777777 commented on Oct 13, 2025

    @MasterMind7777777
    ContributorAuthor

    @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.

  5. donnielrt commented on Oct 13, 2025

    @donnielrt

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

  6. donnielrt commented on Oct 16, 2025

    @donnielrt

    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!

    Image Image
  7. ak127a commented on Oct 17, 2025

    @ak127a

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

  8. removed
    enhancement
    on Oct 31, 2025
  9. sgeier commented on Nov 1, 2025

    @sgeier

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

    Image
  10. MasterMind7777777 commented on Nov 1, 2025

    @MasterMind7777777
    ContributorAuthor

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

    Image

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

  11. added a commit that references this issue on Nov 14, 2025
    3758cf8
  12. added a commit that references this issue on Dec 2, 2025
    a1e62a5
  13. dolzenko commented on Apr 6, 2026

    @dolzenko

    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.

  14. MasterMind7777777 commented on Apr 6, 2026

    @MasterMind7777777
    ContributorAuthor

    @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?

  15. dolzenko commented on Apr 7, 2026

    @dolzenko

    @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.

  16. dolzenko commented on Apr 7, 2026

    @dolzenko

    @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."

  17. MasterMind7777777 commented on Apr 20, 2026

    @MasterMind7777777
    ContributorAuthor

    @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.

  18. added a commit that references this issue on Jun 27, 2026
    8231ae7
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bug

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions