zed-industries/zed · error

Callback above only returns Some

Error message

Callback above only returns Some

What it means

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.

Source

Thrown at crates/gpui/src/window.rs:4782

        Ok(())
    }

    /// Paint an image into the scene for the next frame at the current z-index.
    /// This method will panic if the frame_index is not valid
    ///
    /// This method should only be called as part of the paint phase of element drawing.
    /// Paint an image into `bounds`, positioning and scaling it according to `image_bounds`.
    ///
    /// The visible region rendered is `bounds.intersect(&image_bounds)`, with `corner_radii`
    /// applied to `bounds`.
    pub fn paint_image(
        &mut self,
        bounds: Bounds<Pixels>,
        image_bounds: Bounds<Pixels>,
        corner_radii: Corners<Pixels>,
        data: Arc<RenderImage>,
        frame_index: usize,
        grayscale: bool,
    ) -> Result<()> {
        self.invalidator.debug_assert_paint();

        let visible_bounds = bounds.intersect(&image_bounds);
        if visible_bounds.size.width <= Pixels::ZERO || visible_bounds.size.height <= Pixels::ZERO {
            return Ok(());
        }
        if image_bounds.size.width <= Pixels::ZERO || image_bounds.size.height <= Pixels::ZERO {
            return Ok(());
        }

        let params = RenderImageParams {
            image_id: data.id,
            frame_index,
        };

        let tile = self

View on GitHub (pinned to 9d272b0363)

Solutions

  1. Confirm the closure cannot return Ok(None) (it always wraps size/bytes in Some)
  2. Check for atlas implementations that mishandle just-inserted keys
  3. Report as a GPUI internal bug with a minimal image-rendering repro
Defensive patterns

Strategy: validation

When it happens

Trigger: Thrown at crates/gpui/src/window.rs:4528 when the library encounters an invalid state.

Common situations: See trigger scenarios.


AI-assisted analysis of zed-industries/zed@9d272b0363 (2026-08-20). Data as JSON: /api/errors/8533e0452e41337c. Report an issue: GitHub.