bevyengine/bevy · error

Sampler array should exist

Error message

Sampler array should exist

What it means

Internal invariant panic in bindless resource cleanup: the samplers slot array for a BindlessResourceType had no entry when removing a binding. Indicates bindless state bookkeeping corruption (slot removed twice or never allocated); typically unreachable in correct usage.

Source

Thrown at crates/bevy_render/src/material_bind_groups.rs:1421

                    .remove(bindless_binding),
                BindlessResourceType::ShaderBuffer => self
                    .shader_buffers
                    .get_mut(&bindless_index)
                    .expect("Shader buffer should exist with that bindless index")
                    .remove(bindless_binding),
                BindlessResourceType::DataBuffer => {
                    self.data_buffers
                        .get_mut(&bindless_index)
                        .expect("Data buffer should exist with that bindless index")
                        .remove(bindless_binding);
                    false
                }
                BindlessResourceType::SamplerFiltering
                | BindlessResourceType::SamplerNonFiltering
                | BindlessResourceType::SamplerComparison => self
                    .samplers
                    .get_mut(bindless_resource_type)
                    .expect("Sampler array should exist")
                    .remove(bindless_binding),
                BindlessResourceType::Texture1d
                | BindlessResourceType::Texture2d
                | BindlessResourceType::Texture2dArray
                | BindlessResourceType::Texture3d
                | BindlessResourceType::TextureCube
                | BindlessResourceType::TextureCubeArray => self
                    .textures
                    .get_mut(bindless_resource_type)
                    .expect("Texture array should exist")
                    .remove(bindless_binding),
            };

            // If the slot is now free, decrement the allocated resource
            // count.
            if decrement_allocated_resource_count {
                self.allocated_resource_count -= 1;
            }

View on GitHub (pinned to 396ca72708)

Solutions

  1. Report as a Bevy engine bug with a reproducing project
  2. Avoid the material configuration that triggers the state mismatch
Defensive patterns

Strategy: fallback

When it happens

Trigger: Thrown at crates/bevy_render/src/material_bind_groups.rs:1421 when the library encounters an invalid state.

Common situations: See trigger scenarios.


AI-assisted analysis of bevyengine/bevy@396ca72708 (2026-08-20). Data as JSON: /api/errors/3912b733398ca9e1. Report an issue: GitHub.