actix/actix · error · panic
Got unknown value
Error message
Got unknown value: {:?} What it means
SystemRegistry::get panics when the registry holds a boxed value for this actor's TypeId that cannot be downcast to Addr<A>. Since the registry only inserts Addr<A> for type A, hitting this means internal invariant corruption — the stored entry's concrete type does not match the requested key type. It indicates a bug or unsafe manipulation of the registry.
Solutions
- Audit any code that inserts into the registry to ensure it only inserts Box::new(addr.clone()) of Addr<A> under TypeId::of::<A>().
- Check for duplicate versions of the actix crate in your dependency tree (cargo tree -d) causing TypeId confusion.
- Avoid unsafe insertion into SystemRegistry; use the public get/set API only.
- If it persists, file a bug with a minimal reproduction since this should be unreachable.
Defensive patterns
Strategy: fallback
Type guard
// Check before relying on registry contents let known = reg.registry.contains_key(&TypeId::of::<A>());
Try / catch
// Panic is not catchable in safe patterns; ensure only public API inserts into registry let addr = SystemRegistry::get::<MyService>(); // starts or returns existing
Prevention
- Never insert into the registry except via the public API
- Avoid duplicate versions of the actix crate in your dependency tree (cargo tree -d)
- Avoid unsafe code that inserts Box<dyn Any> values keyed by TypeId
- Report reproducible occurrences as upstream bugs
When it happens
Trigger: Calling SystemRegistry::get::<A>() when reg.registry contains an entry keyed by TypeId::of::<A>() whose downcast_ref::<Addr<A>>() returns None — only possible if a non-Addr<A> Box<dyn Any> was inserted under A's TypeId.
Common situations: Custom registry manipulation or unsafe code inserting foreign boxes; version mismatches where the same crate appears twice (distinct TypeIds for what looks like the same actor); memory corruption from unsafe code.
Understand the failure class
Background: "This is a bug, please report it": internal invariant violations, unreachable panics, and SNH errors explained — this error's family across 47 libraries.
Related errors
- Actor already started
- Message type should always be M
- wrong return type for message
- Mocker actor used before set
- Map must not be polled after it returned `Poll::Ready`
AI-assisted analysis of actix/actix@36e5d97e41 (2026-09-11).
Data as JSON: /api/errors/76c9c8799708c54e.
Report an issue: GitHub.
Appendix: source
Thrown at actix/src/registry.rs:303
addr
}
}
impl SystemRegistry {
pub(crate) fn new(system: ArbiterHandle) -> Self {
Self {
system,
registry: HashMap::default(),
}
}
/// Return address of the service. If service actor is not running
/// it get started in the system.
pub fn get<A: SystemService + Actor<Context = Context<A>>>(&mut self) -> Addr<A> {
if let Some(addr) = self.registry.get(&TypeId::of::<A>()) {
match addr.downcast_ref::<Addr<A>>() {
Some(addr) => return addr.clone(),
None => panic!("Got unknown value: {:?}", addr),
}
}
let addr = A::start_service(&self.system);
self.registry
.insert(TypeId::of::<A>(), Box::new(addr.clone()));
addr
}
/// Check if actor is in registry, if so, return its address
pub fn query<A: SystemService + Actor<Context = Context<A>>>(&self) -> Option<Addr<A>> {
if let Some(addr) = self.registry.get(&TypeId::of::<A>()) {
match addr.downcast_ref::<Addr<A>>() {
Some(addr) => return Some(addr.clone()),
None => return None,
}
}
View on GitHub (pinned to 36e5d97e41)