codex icon indicating copy to clipboard operation
codex copied to clipboard

Image paste fails on GNOME Wayland because arboard requires data-control; wl-paste works

Open egalanos opened this issue 6 months ago • 3 comments

What version of Codex CLI is running?

v0.134.0

What subscription do you have?

Pro 200

Which model were you using?

gpt-5.5

What platform is your computer?

Linux 7.0.9-204.fc44.x86_64 x86_64 unknown

What terminal emulator and version are you using (if applicable)?

VS Code

Codex doctor report

]0;codex{
  "schemaVersion": 1,
  "generatedAt": "1779971214s since unix epoch",
  "overallStatus": "ok",
  "codexVersion": "0.134.0",
  "checks": {
    "app_server.status": {
      "id": "app_server.status",
      "category": "app-server",
      "status": "ok",
      "summary": "background server is not running",
      "details": {
        "control socket": "/state/shared/codex/profiles/personal/app-server-control/app-server-control.sock",
        "daemon state dir": "/state/shared/codex/profiles/personal/app-server-daemon",
        "mode": "ephemeral",
        "pid file": "/state/shared/codex/profiles/personal/app-server-daemon/app-server.pid (missing)",
        "settings": "/state/shared/codex/profiles/personal/app-server-daemon/settings.json (missing)",
        "status": "not running",
        "update-loop pid file": "/state/shared/codex/profiles/personal/app-server-daemon/app-server-updater.pid (missing)"
      },
      "remediation": null,
      "durationMs": 0
    },
    "auth.credentials": {
      "id": "auth.credentials",
      "category": "auth",
      "status": "ok",
      "summary": "auth is configured",
      "details": {
        "auth file": "/state/shared/codex/profiles/personal/auth.json",
        "auth storage mode": "File",
        "stored API key": "false",
        "stored ChatGPT tokens": "true",
        "stored agent identity": "false",
        "stored auth mode": "chatgpt"
      },
      "remediation": null,
      "durationMs": 0
    },
    "config.load": {
      "id": "config.load",
      "category": "config",
      "status": "ok",
      "summary": "config loaded",
      "details": {
        "CODEX_HOME": "/state/shared/codex/profiles/personal",
        "config.toml": "/state/shared/codex/profiles/personal/config.toml",
        "config.toml parse": "ok",
        "cwd": "/workspaces/harness-lab",
        "enabled feature flags": "shell_tool, unified_exec, shell_snapshot, terminal_resize_reflow, sqlite, hooks, enable_request_compression, multi_agent, tool_suggest, plugins, in_app_browser, browser_use, browser_use_external, computer_use, plugin_sharing, image_generation, skill_mcp_dependency_install, steer, guardian_approval, goals, collaboration_modes, tool_call_mcp_elicitation, personality, fast_mode, tui_app_server, workspace_dependencies",
        "feature flag overrides": "apps=false",
        "feature flags enabled": "26",
        "log dir": "/state/shared/codex/profiles/personal/log",
        "mcp servers": "1",
        "model": "gpt-5.5",
        "model provider": "openai",
        "sqlite home": "/home/devuser/.codex/shared/sqlite"
      },
      "remediation": null,
      "durationMs": 0
    },
    "installation": {
      "id": "installation",
      "category": "install",
      "status": "ok",
      "summary": "installation looks consistent",
      "details": {
        "PATH codex #1": "/home/devuser/.bun/bin/codex",
        "PATH codex #2": "/home/devuser/.bun/bin/codex",
        "PATH codex #3": "/home/devuser/.bun/bin/codex",
        "PATH codex entries": "3",
        "current executable": "/home/devuser/.bun/install/global/node_modules/@openai/codex-linux-x64/vendor/x86_64-unknown-linux-musl/bin/codex",
        "install context": "bun (package /home/devuser/.bun/install/global/node_modules/@openai/codex-linux-x64/vendor/x86_64-unknown-linux-musl, bin /home/devuser/.bun/install/global/node_modules/@openai/codex-linux-x64/vendor/x86_64-unknown-linux-musl/bin, resources /home/devuser/.bun/install/global/node_modules/@openai/codex-linux-x64/vendor/x86_64-unknown-linux-musl/codex-resources, path /home/devuser/.bun/install/global/node_modules/@openai/codex-linux-x64/vendor/x86_64-unknown-linux-musl/codex-path)",
        "managed by bun": "true",
        "managed by npm": "false",
        "managed package root": "/home/devuser/.bun/install/global/node_modules/@openai/codex"
      },
      "remediation": null,
      "durationMs": 0
    },
    "mcp.config": {
      "id": "mcp.config",
      "category": "mcp",
      "status": "ok",
      "summary": "MCP configuration is locally consistent",
      "details": {
        "configured servers": "1",
        "disabled servers": "0",
        "stdio servers": "1"
      },
      "remediation": null,
      "durationMs": 0
    },
    "network.env": {
      "id": "network.env",
      "category": "network",
      "status": "ok",
      "summary": "network-related environment looks readable",
      "details": {
        "proxy env vars": "none"
      },
      "remediation": null,
      "durationMs": 0
    },
    "network.provider_reachability": {
      "id": "network.provider_reachability",
      "category": "reachability",
      "status": "ok",
      "summary": "active provider endpoints are reachable over HTTP",
      "details": {
        "ChatGPT base URL": "https://chatgpt.com/backend-api/ reachable (HTTP 404)",
        "reachability mode": "ChatGPT auth"
      },
      "remediation": null,
      "durationMs": 120
    },
    "network.websocket_reachability": {
      "id": "network.websocket_reachability",
      "category": "websocket",
      "status": "ok",
      "summary": "Responses WebSocket handshake succeeded",
      "details": {
        "DNS": "2 IPv4, 2 IPv6, first IPv4",
        "auth mode": "chatgpt",
        "connect timeout": "15000 ms",
        "endpoint": "wss://chatgpt.com/backend-api/<redacted>",
        "handshake result": "HTTP 101 Switching Protocols",
        "model provider": "openai",
        "models etag present": "true",
        "provider name": "OpenAI",
        "proxy env vars": "none",
        "reasoning header": "false",
        "server model present": "false",
        "supports websockets": "true",
        "wire API": "responses"
      },
      "remediation": null,
      "durationMs": 476
    },
    "runtime.provenance": {
      "id": "runtime.provenance",
      "category": "runtime",
      "status": "ok",
      "summary": "running bun on linux-x86_64",
      "details": {
        "commit": "unknown",
        "current executable": "/home/devuser/.bun/install/global/node_modules/@openai/codex-linux-x64/vendor/x86_64-unknown-linux-musl/bin/codex",
        "install method": "bun (package /home/devuser/.bun/install/global/node_modules/@openai/codex-linux-x64/vendor/x86_64-unknown-linux-musl, bin /home/devuser/.bun/install/global/node_modules/@openai/codex-linux-x64/vendor/x86_64-unknown-linux-musl/bin, resources /home/devuser/.bun/install/global/node_modules/@openai/codex-linux-x64/vendor/x86_64-unknown-linux-musl/codex-resources, path /home/devuser/.bun/install/global/node_modules/@openai/codex-linux-x64/vendor/x86_64-unknown-linux-musl/codex-path)",
        "platform": "linux-x86_64",
        "version": "0.134.0"
      },
      "remediation": null,
      "durationMs": 0
    },
    "runtime.search": {
      "id": "runtime.search",
      "category": "search",
      "status": "ok",
      "summary": "search is OK (bundled)",
      "details": {
        "search command": "/home/devuser/.bun/install/global/node_modules/@openai/codex-linux-x64/vendor/x86_64-unknown-linux-musl/codex-path/rg",
        "search command readiness": "file exists",
        "search provider": "bundled"
      },
      "remediation": null,
      "durationMs": 0
    },
    "sandbox.helpers": {
      "id": "sandbox.helpers",
      "category": "sandbox",
      "status": "ok",
      "summary": "sandbox configuration is readable",
      "details": {
        "approval policy": "OnRequest",
        "codex-linux-sandbox helper": "/state/shared/codex/profiles/personal/tmp/arg0/codex-arg0oDjr9f/codex-linux-sandbox",
        "execve wrapper helper": "/state/shared/codex/profiles/personal/tmp/arg0/codex-arg0oDjr9f/codex-execve-wrapper",
        "filesystem sandbox": "restricted",
        "network sandbox": "enabled"
      },
      "remediation": null,
      "durationMs": 0
    },
    "state.paths": {
      "id": "state.paths",
      "category": "state",
      "status": "ok",
      "summary": "state paths and databases are inspectable",
      "details": {
        "CODEX_HOME": "/state/shared/codex/profiles/personal (dir)",
        "active rollout files": "1435 files, 1233390863 total bytes, 859505 average bytes",
        "archived rollout files": "9 files, 1396272 total bytes, 155141 average bytes",
        "goals DB": "/home/devuser/.codex/shared/sqlite/goals_1.sqlite (file)",
        "goals DB integrity": "ok",
        "log DB": "/home/devuser/.codex/shared/sqlite/logs_2.sqlite (file)",
        "log DB integrity": "ok",
        "log dir": "/state/shared/codex/profiles/personal/log (dir)",
        "sqlite home": "/home/devuser/.codex/shared/sqlite (dir)",
        "state DB": "/home/devuser/.codex/shared/sqlite/state_5.sqlite (file)",
        "state DB integrity": "ok"
      },
      "remediation": null,
      "durationMs": 446
    },
    "terminal.env": {
      "id": "terminal.env",
      "category": "terminal",
      "status": "ok",
      "summary": "terminal metadata was detected",
      "details": {
        "COLORTERM": "truecolor",
        "DISPLAY": "present",
        "TERM_PROGRAM": "vscode",
        "VSCODE_IPC_HOOK_CLI": "present",
        "WAYLAND_DISPLAY": "present",
        "color output": "disabled (stdout is not a terminal)",
        "effective locale": "en_AU.UTF-8",
        "stderr is terminal": "true",
        "stdin is terminal": "true",
        "stdout is terminal": "false",
        "terminal": "VS Code",
        "terminal size": "124x71",
        "terminal version": "1.121.0"
      },
      "remediation": null,
      "durationMs": 0
    },
    "updates.status": {
      "id": "updates.status",
      "category": "updates",
      "status": "ok",
      "summary": "update configuration is locally consistent",
      "details": {
        "cached latest version": "0.134.0",
        "check for update on startup": "true",
        "last checked at": "2026-05-28T03:50:04.494553265Z",
        "latest version": "0.134.0",
        "latest version status": "current version is not older",
        "update action": "bun install -g @openai/codex",
        "version cache": "/state/shared/codex/profiles/personal/version.json"
      },
      "remediation": null,
      "durationMs": 149
    }
  }
}

What issue are you seeing?

Pasting an image fails with error:

■ Failed to paste image: clipboard unavailable: Unknown error while interacting with the clipboard: X11 server connection timed out because it was unreachable

What steps can reproduce the bug?

Using codex within a vscode devcontainer

Host compositor does not expose arboard-required data-control protocols:

  wayland-info | rg 'ext_data_control|zwlr_data_control|wl_data_device_manager'
  interface: 'wl_data_device_manager', version: 3, name: 5

  wayland-info | rg -q 'ext_data_control_manager_v1|zwlr_data_control_manager_v1' \
    && echo 'data-control supported' \
    || echo 'data-control not exposed'
  data-control not exposed

Inside the devcontainer: WAYLAND_DISPLAY is set and the socket exists. wl-paste --list-types works, including with DISPLAY unset. xclip against DISPLAY fails because VS Code X11 forwarding is not usable/authorized.

Could probably reproduce on a Gnome desktop by unsetting DISPLAY.

What is the expected behavior?

Codex should paste images on GNOME Wayland when wl-paste can read the image clipboard.

On Linux, when arboard image paste fails and WAYLAND_DISPLAY is present, Codex should try wl-paste for image MIME types before returning the arboard/X11 error.

Additional information

Host: Fedora GNOME Wayland / Mutter Container: VS Code devcontainer with forwarded Wayland socket

Codex uses arboard. arboard requires Wayland data-control, which GNOME/Mutter does not expose (for security?), then falls back to X11 and fails (VS code isn't forwarding X11 properly for some unknown reason).

Claude Code image pasting works as they have a wl-paste fallback.

Some other relevant, but not identical issues:

  • #4824: explains why upstream thinks Wayland was fixed by enabling arboard’s wayland-data-control.
  • #4818: original Wayland image-paste issue closed by #4824.
  • #12836: same X11 timeout error shape, though for /copy.

egalanos avatar May 28 '26 12:05 egalanos

This patch will fix the wl-paste issue for waypipe...

codex-0.145-waypipe-image-paste.patch

heavysink avatar Jul 24 '26 15:07 heavysink

I can reproduce this on a native GNOME Wayland session, without a container.

wl-paste can read the image clipboard both outside and inside tmux:

$ wl-paste --type image/png >/dev/null && echo success
success

However, Codex appears to depend on XWayland:

$ codex
# image paste works

$ env -u DISPLAY codex
# image paste fails

Inside a long-running tmux shell, image paste failed with:

Failed to paste image: clipboard unavailable: Unknown error while interacting with the clipboard: X11 server connection timed out because it was unreachable

The tmux session environment contained the current Mutter XWayland authorization file, but the existing shell did not:

$ tmux show-environment -s XAUTHORITY
XAUTHORITY="/run/user/1000/.mutter-Xwaylandauth.MCSCT3"; export XAUTHORITY;

$ printf '%s\n' "$XAUTHORITY"
# nada

After importing the tmux session environment into the shell, Codex image paste immediately worked:

$ eval "$(
    for variable in DISPLAY XAUTHORITY WAYLAND_DISPLAY XDG_RUNTIME_DIR; do
      tmux show-environment -s "$variable"
    done
  )"

$ codex
# image paste works

So tmux exposed the problem, but does not appear to be its root cause:

  • the Wayland clipboard is reachable and contains the image;
  • wl-paste works;
  • Codex fails when XWayland access is unavailable;
  • restoring XAUTHORITY restores Codex image paste.

This supports adding a wl-paste fallback when arboard cannot use its native Wayland backend, rather than requiring working XWayland credentials for image paste on GNOME Wayland.


Anyways... I added this to my dotfiles, and I'm set for now:

~/.zshrc

# Sync GUI environment variables into tmux sessions (codex screenshot paste bug with wayland)
_tmux_sync_gui_environment() {
	[[ -n $TMUX ]] || return

	eval "$(
		for variable in DISPLAY XAUTHORITY WAYLAND_DISPLAY XDG_RUNTIME_DIR; do
			tmux show-environment -s "$variable" 2>/dev/null
		done
	)"
}

autoload -Uz add-zsh-hook
add-zsh-hook precmd _tmux_sync_gui_environment
_tmux_sync_gui_environment

and ~/.tmux.conf:

set-option -ag update-environment " DISPLAY XAUTHORITY WAYLAND_DISPLAY XDG_RUNTIME_DIR"

kjanat avatar Aug 05 '26 15:08 kjanat

(response from codex)

Maintainer note — Let’s wait for arboard#223 and avoid invoking wl-paste from the TUI. On GNOME, wl-paste briefly opens a transparent window and relies on getting keyboard focus. Adding that fallback would introduce an external dependency and could hang if GNOME doesn’t grant focus.

We reproduced this on Codex CLI 0.171.0 with DISPLAY unset. arboard 3.7.0 still falls back to X11 when GNOME lacks Wayland data-control support, so upgrading alone won’t fix it.

Revisit once arboard supports reading images on GNOME Wayland from a process without its own window. To verify, copy a PNG, run env -u DISPLAY codex, and confirm Ctrl+V attaches [Image #1] without wl-paste installed.

In the meantime, saving the image to a file and pasting its absolute path into the composer works.

etraut-openai avatar Nov 22 '26 00:11 etraut-openai