DioxusLabs/dioxus · error
Callback was manually dropped
Error message
Callback was manually dropped
What it means
Callback::call tried to call a callback whose inner closure slot was empty because the Callback was manually dropped (e.g. by Callback::drop or replacing it). The RefCell write returned None, indicating the callback no longer exists at call time.
Source
Thrown at packages/core/src/events.rs:532
Location::caller(),
);
Self { callback, origin }
}
/// Call this callback with the appropriate argument type
///
/// This borrows the callback using a RefCell. Recursively calling a callback will cause a panic.
#[track_caller]
pub fn call(&self, arguments: Args) -> Ret {
if let Some(callback) = self.callback.write().as_mut() {
let runtime = callback
.runtime
.upgrade()
.expect("Callback was called after the runtime was dropped");
let _guard = RuntimeGuard::new(runtime.clone());
runtime.with_scope_on_stack(self.origin, || (callback.callback)(arguments))
} else {
panic!("Callback was manually dropped")
}
}
/// Create a `impl FnMut + Copy` closure from the Closure type
pub fn into_closure(self) -> impl FnMut(Args) -> Ret + Copy + 'static {
move |args| self.call(args)
}
/// Forcibly drop the internal handler callback, releasing memory
///
/// This will force any future calls to "call" to not doing anything
pub fn release(&self) {
self.callback.set(None);
}
/// Replace the function in the callback with a new one
pub fn replace(&mut self, callback: Box<dyn FnMut(Args) -> Ret>) {
let runtime = Runtime::current();View on GitHub (pinned to 24f6a829df)
Solutions
- The Callback was dropped before the event fired. Keep the callback alive (clone it) for as long as the event may be dispatched.
Defensive patterns
Strategy: type-guard
When it happens
Trigger: Thrown at packages/core/src/events.rs:532 when the library encounters an invalid state.
Common situations: See trigger scenarios.
AI-assisted analysis of DioxusLabs/dioxus@24f6a829df (2026-08-23).
Data as JSON: /api/errors/f4451710c2f7543c.
Report an issue: GitHub.