zed-industries/zed · error
detected over-release of a handle.
Error message
detected over-release of a handle.
What it means
AnyEntity::drop decrements the entity's reference count; the expect fires when there is no count entry for this entity_id, i.e. the handle is being dropped more times than it was cloned or after the entity was already released. This detects double-drop / over-release of GPUI entity handles.
Source
Thrown at crates/gpui/src/app/entity_map.rs:346
handle_id: self
.entity_map
.upgrade()
.unwrap()
.write()
.leak_detector
.handle_created(self.entity_id, None),
}
}
}
impl Drop for AnyEntity {
fn drop(&mut self) {
if let Some(entity_map) = self.entity_map.upgrade() {
let entity_map = entity_map.upgradable_read();
let count = entity_map
.counts
.get(self.entity_id)
.expect("detected over-release of a handle.");
let prev_count = count.fetch_sub(1, SeqCst);
assert_ne!(prev_count, 0, "Detected over-release of a entity.");
if prev_count == 1 {
// We were the last reference to this entity, so we can remove it.
let mut entity_map = RwLockUpgradableReadGuard::upgrade(entity_map);
entity_map.dropped_entity_ids.push(self.entity_id);
}
}
#[cfg(any(test, feature = "leak-detection"))]
if let Some(entity_map) = self.entity_map.upgrade() {
entity_map
.write()
.leak_detector
.handle_released(self.entity_id, self.handle_id)
}
}
}View on GitHub (pinned to f4178619ac)
Solutions
- Search for manual drops or unsafe code causing a duplicate Drop of the same handle
- Check for a clone/drop imbalance, e.g. transmuted or forgotten clones
- Enable the leak detector output to trace handle creation and drops
Defensive patterns
Strategy: validation
When it happens
Trigger: Thrown at crates/gpui/src/app/entity_map.rs:346 when the library encounters an invalid state.
Common situations: See trigger scenarios.
AI-assisted analysis of zed-industries/zed@f4178619ac (2026-08-20).
Data as JSON: /api/errors/ff8b8299b3b49b4d.
Report an issue: GitHub.