{"record":{"id":"ba4522804684ef46","repo":"bevyengine/bevy","slug":"a-slot-in-the-resource-to-slot-map-should-have-a-v","errorCode":null,"errorMessage":"A slot in the resource_to_slot map should have a value","messagePattern":"A slot in the resource_to_slot map should have a value","errorType":"panic","errorClass":null,"httpStatus":null,"severity":"error","filePath":"crates/bevy_render/src/material_bind_groups.rs","lineNumber":2130,"sourceCode":"        self.bindings\n            .get(slot as usize)\n            .is_some_and(|maybe_binding| {\n                maybe_binding.as_ref().is_some_and(|binding| {\n                    binding.resource.binding_resource_id(self.resource_type) == binding_resource_id\n                })\n            })\n    }\n\n    /// Inserts a bindless resource into a binding array and returns the index\n    /// of the slot it was inserted into.\n    fn insert(&mut self, binding_resource_id: BindingResourceId, resource: R) -> u32 {\n        match self.resource_to_slot.entry(binding_resource_id) {\n            Entry::Occupied(o) => {\n                let slot = *o.get();\n\n                self.bindings[slot as usize]\n                    .as_mut()\n                    .expect(\"A slot in the resource_to_slot map should have a value\")\n                    .ref_count += 1;\n\n                slot\n            }\n            Entry::Vacant(v) => {\n                let slot = self.free_slots.pop().unwrap_or(self.len);\n                v.insert(slot);\n\n                if self.bindings.len() < slot as usize + 1 {\n                    self.bindings.resize_with(slot as usize + 1, || None);\n                }\n                debug_assert!(self.bindings[slot as usize].is_none());\n                self.bindings[slot as usize] = Some(MaterialBindlessBinding::new(resource));\n\n                self.len += 1;\n                slot\n            }\n        }","sourceCodeStart":2112,"sourceCodeEnd":2148,"githubUrl":"https://github.com/bevyengine/bevy/blob/396ca727080776bd313bb892423b7d94e03b81b4/crates/bevy_render/src/material_bind_groups.rs#L2112-L2148","documentation":"Internal invariant expect in the bindless binding-array bookkeeping: a resource_to_slot lookup expected an existing slot for the resource but found none, indicating the slot map is out of sync with the bindings.","triggerScenarios":"Thrown at crates/bevy_render/src/material_bind_groups.rs:2130 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Report as a Bevy engine bug with a reproducing project","Avoid the resource add/remove sequence that triggers the desync"],"exampleFix":null,"handlingStrategy":"fallback","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"396ca727080776bd313bb892423b7d94e03b81b4","analyzedAt":"2026-08-20T16:12:39.808Z","contentChangedAt":"2026-08-20T16:12:39.808Z","schemaVersion":2},"datasetVersion":"2026-09-14T00:17:10.932Z"}