sxyazi/yazi · error
image is empty
Error message
image is empty
What it means
The image passed into sixel encoding has a zero width or height, so there are no pixels to encode. This is a precondition guard before spawning the blocking encoder; the faulting input is the decoded `DynamicImage` (e.g. a truncated or corrupt image that still decoded to an empty frame).
Source
Thrown at yazi-adapter/src/drivers/sixel.rs:52
pub(super) fn image_erase(area: Rect) -> Result<()> {
let s = " ".repeat(area.width as usize);
Emulator::move_lock((0, 0), |w| {
if let Some(c) = THEME.app.overall.get().bg {
write!(w, "{}", SetBg(c))?;
}
for y in area.top()..area.bottom() {
write!(w, "{}", MoveTo(area.x, y))?;
write!(w, "{s}")?;
}
Ok(write!(w, "{ResetAttrs}")?)
})
}
async fn encode(img: DynamicImage) -> Result<Vec<u8>> {
let alpha = img.color().has_alpha();
if img.width() == 0 || img.height() == 0 {
bail!("image is empty");
}
let (qo, img) = tokio::task::spawn_blocking(move || match &img {
DynamicImage::ImageRgb8(rgb) => Self::quantify(rgb, false).map(|q| (q, img)),
_ => Self::quantify(&img.to_rgb8(), alpha).map(|q| (q, img)),
})
.await??;
tokio::task::spawn_blocking(move || {
let mut buf = vec![];
write!(buf, "{START}P9;1q\"1;1;{};{}", img.width(), img.height())?;
// Palette
for (i, c) in qo.palette.iter().enumerate() {
write!(
buf,
"#{};2;{};{};{}",
i + alpha as usize,View on GitHub (pinned to 5f901b886b)
Solutions
- Check the source image for corruption or zero dimensions before previewing.
- Skip sixel preview for empty images and let a text/other previewer take over.
- Validate image dimensions after decoding and before dispatching to an adapter.
Defensive patterns
Strategy: validation
When it happens
Trigger: Thrown at yazi-adapter/src/drivers/sixel.rs:52 when the library encounters an invalid state.
Common situations: See trigger scenarios.
AI-assisted analysis of sxyazi/yazi@5f901b886b (2026-09-02).
Data as JSON: /api/errors/52ad29b852cc9469.
Report an issue: GitHub.