zed-industries/zed · error
It's the caller's job to pass a valid frame index
Error message
It's the caller's job to pass a valid frame index
What it means
When rendering an image frame into the sprite atlas, data.as_bytes(frame_index) is expected to succeed because the caller passed a valid frame index (bounds were checked just above). Panicking means an out-of-range frame index reached this function — a caller-side contract violation for RenderImage frame data.
Source
Thrown at crates/gpui/src/window.rs:4778
color: color.opacity(element_opacity),
tile,
transformation,
});
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,View on GitHub (pinned to 9d272b0363)
Solutions
- Ensure callers only pass frame_index values within the image's frame count
- Validate frame_index at the API boundary before paint
- Check image decoders producing inconsistent frame counts vs as_bytes
Defensive patterns
Strategy: validation
When it happens
Trigger: Thrown at crates/gpui/src/window.rs:4524 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/ec22a0b9850dccec.
Report an issue: GitHub.