iced-rs/iced · error

Render cached text

Error message

Render cached text

What it means

This panic fires inside iced's wgpu backend when cryoglyph's TextRenderer::render returns an error while drawing a cached text layer — text laid out in an earlier frame and kept in Storage, then re-rendered via `upload.renderer.render(atlas, &viewport.0, render_pass)` at wgpu/src/text.rs:410-416. The failure is almost always RenderError::RemovedFromAtlas: a glyph this renderer placed in the glyph atlas was evicted, or the atlas was reallocated, between the prepare and render phases; a lost GPU device produces the same panic via the atlas render error. Because iced unwraps with .expect("Render cached text"), the render thread panics and the process aborts. It is an internal iced_wgpu/cryoglyph failure (iced calls the fork of glyphon, see Cargo.toml: `cryoglyph`), not a mistake in application code.

Source

Thrown at wgpu/src/text.rs:415

        render_pass.set_scissor_rect(bounds.x, bounds.y, bounds.width, bounds.height);

        for item in batch {
            match item {
                Item::Group { .. } => {
                    let renderer = &self.renderers[start + layer_count];

                    renderer
                        .render(&atlas, &viewport.0, render_pass)
                        .expect("Render text");

                    layer_count += 1;
                }
                Item::Cached { cache, .. } => {
                    if let Some((atlas, upload)) = self.storage.get(cache) {
                        upload
                            .renderer
                            .render(atlas, &viewport.0, render_pass)
                            .expect("Render cached text");
                    }
                }
            }
        }

        layer_count
    }

    pub fn trim(&mut self) {
        self.cache.trim();
        self.storage.trim();

        self.prepare_layer = 0;
    }
}

fn prepare(
    device: &wgpu::Device,

View on GitHub (pinned to 2cffa99b39)

Solutions

  1. Update iced to the latest release and pin it — this panic lives in iced_wgpu/cryoglyph internals and atlas-eviction/resize occurrences have been fixed across releases; reproduce on the newest version before anything else.
  2. Reduce glyph atlas pressure: load fewer font families and weights, avoid extremely large font sizes and huge offscreen/invisible text blocks, and render very long content in virtualized/lazy lists so not every glyph is prepared each frame.
  3. If it happens only on some machines, check GPU stability: look for 'device lost' in wgpu logs, update GPU drivers, and test with software rendering (LIBGL_ALWAYS_SOFTWARE=1, WGPU_BACKEND=gl) to distinguish a driver reset from an iced bug.
  4. Reproduce with RUST_BACKTRACE=1 and RUST_LOG=iced_wgpu=debug to capture the failing path and the frame that triggers it, then report it at https://github.com/iced-rs/iced/issues with a minimal reproducer (include the resize/scroll steps).
  5. As a stopgap for shipped apps, switch the backend from wgpu to iced's tiny-skia software renderer, which does not use this glyph-atlas path.
Defensive patterns

Strategy: fallback

Try / catch

// iced unwraps internally, so the only guard is a top-level panic boundary
// that degrades instead of dying (kiosk / shipped apps):
fn main() -> iced::Result {
    let run = || iced::application("App", Update::new, View::new).run();
    match std::panic::catch_unwind(run) {
        Ok(result) => result,
        Err(panic) => {
            log::error!("wgpu backend panicked: {panic:?}");
            // fall back to the tiny-skia software backend (no glyph atlas path)
            iced::application("App", Update::new, View::new).run()
        }
    }
}

Prevention

When it happens

Trigger: (1) Resizing the window while cached text layers exist, so the atlas/viewport state baked in at prepare no longer matches what render sees. (2) A frame prepares enough new text (Item::Group) that the shared glyph atlas grows or evicts glyphs still owned by a previously cached layer. (3) The cached layer renders after a GPU device-lost/driver reset invalidated its atlas. (4) Sustained high atlas pressure: many font families, weights, or very large font sizes. Panic path: iced_wgpu::text::State::render -> Item::Cached -> storage.get(cache) -> renderer.render(...).expect("Render cached text").

Common situations: Text-heavy iced apps (log viewers, terminals, editors, chat clients) during rapid resize or scrolling; apps loading many fonts or huge CJK/icon fonts; machines with flaky GPU drivers where wgpu logs 'device lost' before the crash; regressions between iced point releases (0.13/0.14/0.15-dev) as the text-layer cache and the cryoglyph fork evolved.

Related errors


AI-assisted analysis of iced-rs/iced@2cffa99b39 (2026-08-16). Data as JSON: /api/errors/62d2c45881be5ec9. Report an issue: GitHub.