{"record":{"id":"5bdc9c4f91ea9582","repo":"zed-industries/zed","slug":"callback-above-only-errors-or-returns-some","errorCode":null,"errorMessage":"Callback above only errors or returns Some","messagePattern":"Callback above only errors or returns Some","errorType":"panic","errorClass":null,"httpStatus":null,"severity":"error","filePath":"crates/gpui/src/window.rs","lineNumber":4561,"sourceCode":"    /// This method should only be called as part of the paint phase of element drawing.\n    pub fn paint_glyph(\n        &mut self,\n        origin: Point<Pixels>,\n        font_id: FontId,\n        glyph_id: GlyphId,\n        font_size: Pixels,\n        color: Hsla,\n    ) -> Result<()> {\n        self.invalidator.debug_assert_paint();\n\n        let element_opacity = self.element_opacity();\n        let scale_factor = self.scale_factor();\n        let glyph_origin = origin.scale(scale_factor);\n\n        let quantized_origin = Point::new(\n            round_half_toward_zero(glyph_origin.x.0 * SUBPIXEL_VARIANTS_X as f32)\n                / SUBPIXEL_VARIANTS_X as f32,\n            round_half_toward_zero(glyph_origin.y.0 * SUBPIXEL_VARIANTS_Y as f32)\n                / SUBPIXEL_VARIANTS_Y as f32,\n        );\n        let subpixel_variant = Point::new(\n            (quantized_origin.x.fract() * SUBPIXEL_VARIANTS_X as f32) as u8,\n            (quantized_origin.y.fract() * SUBPIXEL_VARIANTS_Y as f32) as u8,\n        );\n        let integer_origin = quantized_origin.map(|c| ScaledPixels(c.trunc()));\n        let subpixel_rendering = self.should_use_subpixel_rendering(font_id, font_size);\n        let dilation = self.text_system().glyph_dilation_for_color(color);\n        let params = RenderGlyphParams {\n            font_id,\n            glyph_id,\n            font_size,\n            subpixel_variant,\n            scale_factor,\n            is_emoji: false,\n            subpixel_rendering,\n            dilation,","sourceCodeStart":4543,"sourceCodeEnd":4579,"githubUrl":"https://github.com/zed-industries/zed/blob/9d272b036335401f339d024ea94968fd51016c40/crates/gpui/src/window.rs#L4543-L4579","documentation":"When inserting a rasterized glyph into the sprite atlas, get_or_insert_with's closure returns Ok(Some(...)) — it can only error or produce a tile. The expect fires if the atlas reported a tile present but the closure produced None, meaning atlas/closure contract violation (internal bug or race).","triggerScenarios":"Thrown at crates/gpui/src/window.rs:4307 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Verify the rasterize_glyph closure always returns Ok(Some(..)) on success","Check for races or double-insert on the same atlas key","Report as a framework bug if the closure provably returns Some"],"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-14T05:17:10.506Z"}