bevyengine/bevy · error
Attempted to free an already-freed binding
Error message
Attempted to free an already-freed binding
What it means
Panic in MaterialBindlessSlotMap::remove: the binding at the given slot is None, i.e. the slot was already freed (or never allocated) when a reference was removed. Indicates double-free of a bindless slot in material binding bookkeeping.
Source
Thrown at crates/bevy_render/src/material_bind_groups.rs:2160
debug_assert!(self.bindings[slot as usize].is_none());
self.bindings[slot as usize] = Some(MaterialBindlessBinding::new(resource));
self.len += 1;
slot
}
}
}
/// Removes a reference to an object from the slot.
///
/// If the reference count dropped to 0 and the object was freed, this
/// method returns true. If the object was still referenced after removing
/// it, returns false.
fn remove(&mut self, slot: u32) -> bool {
let maybe_binding = &mut self.bindings[slot as usize];
let binding = maybe_binding
.as_mut()
.expect("Attempted to free an already-freed binding");
binding.ref_count -= 1;
if binding.ref_count != 0 {
return false;
}
let binding_resource_id = binding.resource.binding_resource_id(self.resource_type);
self.resource_to_slot.remove(&binding_resource_id);
*maybe_binding = None;
self.free_slots.push(slot);
self.len -= 1;
true
}
}
impl<R> MaterialBindlessBinding<R>
whereView on GitHub (pinned to 396ca72708)
Solutions
- Report as a Bevy engine bug with a reproducing project
- Avoid rapid material/resource destruction sequences that trigger the double free
Defensive patterns
Strategy: fallback
When it happens
Trigger: Thrown at crates/bevy_render/src/material_bind_groups.rs:2160 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/e0a3b1bfd7ede108.
Report an issue: GitHub.