{"record":{"id":"d80babd33d7d5b7c","repo":"Canop/broot","slug":"zlib-encoder-error","errorCode":null,"errorMessage":"Zlib encoder error","messagePattern":"Zlib encoder error","errorType":"panic","errorClass":null,"httpStatus":null,"severity":"error","filePath":"src/kitty/image_renderer.rs","lineNumber":249,"sourceCode":"            w.queue(cursor::MoveTo(self.area.left, self.area.top + y))?;\n            write!(w, \"{}\", id_str)?;\n            if id_msb_str.is_empty() {\n                write!(w, \"{}{}\", PLACHOLDER, DIACRITICS[y as usize])?;\n            } else {\n                write!(\n                    w,\n                    \"{}{}{}{}\",\n                    PLACHOLDER, DIACRITICS[y as usize], DIACRITICS[0], id_msb_str\n                )?;\n            }\n            write!(w, \"{}\", PLACHOLDER.repeat(self.area.width as usize - 1),)?;\n            write!(w, \"\\u{1b}[39m\")?;\n        }\n        Ok(())\n    }\n    fn compress(data: &[u8]) -> Result<Vec<u8>, ProgramError> {\n        let mut encoder = ZlibEncoder::new(Vec::new(), Compression::default());\n        encoder.write_all(data).expect(\"Zlib encoder error\");\n        Ok(encoder.finish().expect(\"Zlib encoder error\"))\n    }\n    /// Render the image by sending multiple kitty escape sequences, each\n    /// one with part of the image raw data (encoded as base64)\n    fn print_with_chunks(\n        &self,\n        w: &mut W,\n    ) -> Result<(), ProgramError> {\n        let esc = get_esc_seq(self.tmux_nest_count);\n        let tmux_header = self\n            .is_tmux\n            .then_some(get_tmux_header(self.tmux_nest_count));\n        let tmux_tail = self.is_tmux.then_some(get_tmux_tail(self.tmux_nest_count));\n        let display_tag = match self.display {\n            KittyGraphicsDisplay::Unicode => \"q=2,U=1,\",\n            _ => \"\",\n        };\n        let mut png_buf = Vec::new();","sourceCodeStart":231,"sourceCodeEnd":267,"githubUrl":"https://github.com/Canop/broot/blob/17204794d7c564f21d023c31f105c09ac169dd2d/src/kitty/image_renderer.rs#L231-L267","documentation":"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.","triggerScenarios":"Thrown at src/kitty/image_renderer.rs:249 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","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"],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"17204794d7c564f21d023c31f105c09ac169dd2d","analyzedAt":"2026-09-08T00:58:21.814Z","contentChangedAt":"2026-09-08T00:58:21.814Z","schemaVersion":2},"datasetVersion":"2026-09-15T23:17:13.987Z"}