Canop/broot · error
Zlib encoder error
Error message
Zlib encoder error
What it means
Error produced in the kitty image renderer's compress step when creating the Zlib encoder (ZlibEncoder::new) fails or reports an invalid parameter. The throw site wraps the flate2 encoder construction; failure means the terminal image payload cannot be compressed for transmission, typically due to an invalid compression level or an internal encoder error.
Solutions
- Verify the flate2/zlib dependency version is intact and compatible
- Use a valid Compression level constant (e.g. Compression::default()) instead of a custom level
- If the error persists, disable image preview (kitty graphics protocol) and fall back to another preview mode
Defensive patterns
Strategy: try-catch
When it happens
Trigger: Thrown at src/kitty/image_renderer.rs:249 when the library encounters an invalid state.
Common situations: See trigger scenarios.
AI-assisted analysis of Canop/broot@17204794d7 (2026-09-08).
Data as JSON: /api/errors/d80babd33d7d5b7c.
Report an issue: GitHub.
Appendix: source
Thrown at src/kitty/image_renderer.rs:249
w.queue(cursor::MoveTo(self.area.left, self.area.top + y))?;
write!(w, "{}", id_str)?;
if id_msb_str.is_empty() {
write!(w, "{}{}", PLACHOLDER, DIACRITICS[y as usize])?;
} else {
write!(
w,
"{}{}{}{}",
PLACHOLDER, DIACRITICS[y as usize], DIACRITICS[0], id_msb_str
)?;
}
write!(w, "{}", PLACHOLDER.repeat(self.area.width as usize - 1),)?;
write!(w, "\u{1b}[39m")?;
}
Ok(())
}
fn compress(data: &[u8]) -> Result<Vec<u8>, ProgramError> {
let mut encoder = ZlibEncoder::new(Vec::new(), Compression::default());
encoder.write_all(data).expect("Zlib encoder error");
Ok(encoder.finish().expect("Zlib encoder error"))
}
/// Render the image by sending multiple kitty escape sequences, each
/// one with part of the image raw data (encoded as base64)
fn print_with_chunks(
&self,
w: &mut W,
) -> Result<(), ProgramError> {
let esc = get_esc_seq(self.tmux_nest_count);
let tmux_header = self
.is_tmux
.then_some(get_tmux_header(self.tmux_nest_count));
let tmux_tail = self.is_tmux.then_some(get_tmux_tail(self.tmux_nest_count));
let display_tag = match self.display {
KittyGraphicsDisplay::Unicode => "q=2,U=1,",
_ => "",
};
let mut png_buf = Vec::new();View on GitHub (pinned to 17204794d7)