{"record":{"id":"8533e0452e41337c","repo":"zed-industries/zed","slug":"callback-above-only-returns-some","errorCode":null,"errorMessage":"Callback above only returns Some","messagePattern":"Callback above only returns Some","errorType":"panic","errorClass":null,"httpStatus":null,"severity":"error","filePath":"crates/gpui/src/window.rs","lineNumber":4782,"sourceCode":"\n        Ok(())\n    }\n\n    /// Paint an image into the scene for the next frame at the current z-index.\n    /// This method will panic if the frame_index is not valid\n    ///\n    /// This method should only be called as part of the paint phase of element drawing.\n    /// Paint an image into `bounds`, positioning and scaling it according to `image_bounds`.\n    ///\n    /// The visible region rendered is `bounds.intersect(&image_bounds)`, with `corner_radii`\n    /// applied to `bounds`.\n    pub fn paint_image(\n        &mut self,\n        bounds: Bounds<Pixels>,\n        image_bounds: Bounds<Pixels>,\n        corner_radii: Corners<Pixels>,\n        data: Arc<RenderImage>,\n        frame_index: usize,\n        grayscale: bool,\n    ) -> Result<()> {\n        self.invalidator.debug_assert_paint();\n\n        let visible_bounds = bounds.intersect(&image_bounds);\n        if visible_bounds.size.width <= Pixels::ZERO || visible_bounds.size.height <= Pixels::ZERO {\n            return Ok(());\n        }\n        if image_bounds.size.width <= Pixels::ZERO || image_bounds.size.height <= Pixels::ZERO {\n            return Ok(());\n        }\n\n        let params = RenderImageParams {\n            image_id: data.id,\n            frame_index,\n        };\n\n        let tile = self","sourceCodeStart":4764,"sourceCodeEnd":4800,"githubUrl":"https://github.com/zed-industries/zed/blob/9d272b036335401f339d024ea94968fd51016c40/crates/gpui/src/window.rs#L4764-L4800","documentation":"After get_or_insert_with for an image tile, the closure is guaranteed to return Some(tile) on Ok, so the atlas entry must exist. The expect fires if the closure returned Ok(None) — a broken contract between the rasterization closure and the atlas API, i.e. an internal inconsistency.","triggerScenarios":"Thrown at crates/gpui/src/window.rs:4528 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Confirm the closure cannot return Ok(None) (it always wraps size/bytes in Some)","Check for atlas implementations that mishandle just-inserted keys","Report as a GPUI internal bug with a minimal image-rendering repro"],"exampleFix":null,"handlingStrategy":"validation","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"9d272b036335401f339d024ea94968fd51016c40","analyzedAt":"2026-08-20T19:29:52.058Z","contentChangedAt":"2026-08-20T19:29:52.058Z","schemaVersion":2},"datasetVersion":"2026-09-14T00:17:10.932Z"}