DioxusLabs/dioxus · error
Global signal with key {:?} is not of the expected type. Key
Error message
Global signal with key {:?} is not of the expected type. Keys are {:?} What it means
A global signal looked up by GlobalKey stored a value of a different type than requested. The downcast_ref::<Signal<T>>() failed because the key was first registered with another T; global signal keys are per-type and reusing one with a different type triggers this panic.
Source
Thrown at packages/signals/src/global/mod.rs:269
column: key.column(),
index: 0,
}
}
}
impl From<&'static Location<'static>> for GlobalKey<'static> {
fn from(key: &'static Location<'static>) -> Self {
Self::new(key)
}
}
impl GlobalLazyContext {
/// Get a signal with the given string key
/// The key will be converted to a UUID with the appropriate internal namespace
pub fn get_signal_with_key<T: 'static>(&self, key: GlobalKey) -> Option<Signal<T>> {
self.map.borrow().get(&key).map(|f| {
*f.downcast_ref::<Signal<T>>().unwrap_or_else(|| {
panic!(
"Global signal with key {:?} is not of the expected type. Keys are {:?}",
key,
self.map.borrow().keys()
)
})
})
}
#[doc(hidden)]
/// Clear all global signals of a given type.
pub fn clear<T: 'static>(&self) {
self.map.borrow_mut().retain(|_k, v| !v.is::<T>());
}
}
/// Get the global context for signals
pub fn get_global_context() -> GlobalLazyContext {
let rt = Runtime::current();View on GitHub (pinned to 24f6a829df)
Solutions
- A GlobalSignal key was reused with a different type. Use one consistent type per global signal key, or use a distinct key.
Defensive patterns
Strategy: type-guard
When it happens
Trigger: Thrown at packages/signals/src/global/mod.rs:269 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/1f9376461b9af739.
Report an issue: GitHub.