You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
TUI: image attachment preview renders as a blank thumbnail #41691
Image attachments do not render correctly in the OpenCode TUI. The attachment is shown as an almost blank, dark thumbnail with only the [Image 1] label, so its visual content cannot be reviewed in the chat.
Environment
opencode version: v0.0.0-next-17151
OS: Fedora Linux 44 (Workstation Edition), kernel 7.1.7-200.fc44.x86_64
Terminal: herdr
Shell: zsh 5.9
Install/channel: next
GPU: Intel Arc Pro 130T/140T (integrated)
Active plugins: superpowers@git+https://github.com/obra/superpowers.git
Reproduction
Start the OpenCode TUI.
Attach an image to a prompt.
Send the prompt and inspect the image attachment preview in the chat history.
Expected Behavior
The attachment preview should render the image content in the TUI.
Actual Behavior
The preview renders as an almost empty dark thumbnail and displays only the [Image 1] label. The image content itself is not visible.
Additional Context
The issue was observed in a local workspace while using the next build. A screenshot is available in the associated report context. Reproduction frequency and whether it affects every image have not yet been determined.
I investigated this and found a likely cause related to Kitty image z-index handling.
OpenTUI places image previews at an extremely negative z-index:
-1_500_000_000 + placement_id
The Kitty graphics protocol treats values below INT32_MIN / 2 (-1,073,741,824) specially: images are drawn underneath cells with non-default backgrounds.
This works in a native Ghostty window, but multiplexers such as Herdr and CMux render or replay their own cell backgrounds over the image. The image is transmitted and decoded successfully, but its deep-negative placement causes it to be covered by the multiplexer’s background layer, producing the blank/dark thumbnail.
A differential test using the same PNG and placement confirmed the boundary:
z=-1,499,999,999: image hidden
z=-1: image visible
z=0: image visible
A possible temporary OpenTUI workaround would be to use the normal negative range when running inside affected multiplexers:
const z_base: i32 = if (
std.process.hasEnvVarConstant("HERDR_ENV") or
std.process.hasEnvVarConstant("CMUX_WORKSPACE_ID")
)
-1_000_000_000
else
-1_500_000_000;
const z = z_base + @as(i32, @intCast(placement.placement_id));
Alternatively, OpenTUI could support an opt-in environment variable such as:
OPENTUI_KITTY_SAFE_Z=1 opencode
This would be considered a compatibility workaround rather than a perfect fix. Moving the image above cell backgrounds means menus, modals, selections, or repainted regions may no longer mask it automatically. The ideal long-term fix is for multiplexers to preserve Kitty’s distinction between the default terminal background and explicit cell backgrounds.
Activity
shiroyasha9 commentedon Aug 12, 2026
I investigated this and found a likely cause related to Kitty image
z-indexhandling.OpenTUI places image previews at an extremely negative z-index:
The Kitty graphics protocol treats values below
INT32_MIN / 2(-1,073,741,824) specially: images are drawn underneath cells with non-default backgrounds.This works in a native Ghostty window, but multiplexers such as Herdr and CMux render or replay their own cell backgrounds over the image. The image is transmitted and decoded successfully, but its deep-negative placement causes it to be covered by the multiplexer’s background layer, producing the blank/dark thumbnail.
A differential test using the same PNG and placement confirmed the boundary:
z=-1,499,999,999: image hiddenz=-1: image visiblez=0: image visibleA possible temporary OpenTUI workaround would be to use the normal negative range when running inside affected multiplexers:
Alternatively, OpenTUI could support an opt-in environment variable such as:
This would be considered a compatibility workaround rather than a perfect fix. Moving the image above cell backgrounds means menus, modals, selections, or repainted regions may no longer mask it automatically. The ideal long-term fix is for multiplexers to preserve Kitty’s distinction between the default terminal background and explicit cell backgrounds.
github-actions commentedon Oct 12, 2026
To stay organized issues are automatically closed after 60 days of no activity. If the issue is still relevant please open a new one.