iced-rs/iced · error

Read text atlas

Error message

Read text atlas

What it means

State::render takes the read lock on the shared cryoglyph TextAtlas to bind glyph textures for drawing text layers. As with every std RwLock, read() errs only when the lock is poisoned by a panic that unwound while a writer held it; this panic is the read-side symptom of an earlier failure in text preparation.

Source

Thrown at wgpu/src/text.rs:394

                        cache,
                        layer_transformation * *transformation,
                        layer_bounds * layer_transformation,
                    );
                }
            }
        }
    }

    pub fn render<'a>(
        &'a self,
        pipeline: &'a Pipeline,
        viewport: &'a Viewport,
        start: usize,
        batch: &'a Batch,
        bounds: Rectangle<u32>,
        render_pass: &mut wgpu::RenderPass<'a>,
    ) -> usize {
        let atlas = pipeline.atlas.read().expect("Read text atlas");
        let mut layer_count = 0;

        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

View on GitHub (pinned to 3de451447b)

Solutions

  1. Diagnose and fix the original panic (search above this frame in the backtrace)
  2. Restart the process if the poison already happened; the lock never un-poisons itself
  3. In a patched iced, replace the expect with unwrap_or_else(|poisoned| poisoned.into_inner()) to render with possibly stale atlas data

Example fix

// before (iced internals)
let atlas = pipeline.atlas.read().expect("Read text atlas");

// after
let atlas = pipeline
    .atlas
    .read()
    .unwrap_or_else(|poisoned| poisoned.into_inner());
Defensive patterns

Strategy: fallback

Try / catch

// Recovery pattern for a poisoned atlas read lock (patched iced or your own locks):
let atlas = match pipeline.atlas.read() {
    Ok(guard) => guard,
    Err(poisoned) => poisoned.into_inner(), // draw with last-known-good atlas contents
};

Prevention

When it happens

Trigger: Any frame rendered after a panic inside State::prepare (or Pipeline::trim) unwound through the atlas write guard; the very next render that contains text then aborts here with "Read text atlas".

Common situations: Post-crash rendering attempts in long-lived processes; multi-window apps where the poisoned atlas is shared through the cloned Pipeline; CI screenshot pipelines that continue after swallowing a first panic.

Related errors


AI-assisted analysis of iced-rs/iced@3de451447b (2026-08-17). Data as JSON: /api/errors/24cec67f3e7297ce. Report an issue: GitHub.