nautechsystems/nautilus_trader · error
Component {component_id} not found in actor registry
Error message
Component {component_id} not found in actor registry What it means
Raised in `Trader::load_component_state` when the global actor registry has no component registered under `component_id` (cast to the requested type `T` via `try_get_actor_unchecked::<T>`). The trader cannot deliver persisted state to a component that is not registered, so state loading fails for it.
Source
Thrown at crates/system/src/trader.rs:1703
.get(strategy_id)
.copied()
.map(|callbacks| (*strategy_id, callbacks))
.ok_or_else(|| {
anyhow::anyhow!("Strategy {strategy_id} state callback not found")
})
})
.collect()
}
fn load_component_state<T>(
component_id: Ustr,
state: PersistedComponentState,
) -> anyhow::Result<()>
where
T: DataActor + DataActorNative + Debug + 'static,
{
let mut component = try_get_actor_unchecked::<T>(&component_id).ok_or_else(|| {
anyhow::anyhow!("Component {component_id} not found in actor registry")
})?;
component.on_load(state)
}
fn save_component_state<T>(component_id: Ustr) -> anyhow::Result<PersistedComponentState>
where
T: DataActor + DataActorNative + Debug + 'static,
{
let component = try_get_actor_unchecked::<T>(&component_id).ok_or_else(|| {
anyhow::anyhow!("Component {component_id} not found in actor registry")
})?;
component.on_save()
}
/// Initializes the trader, transitioning from `PreInitialized` to `Ready` state.
///
/// This method must be called before starting the trader.
///View on GitHub (pinned to 18893faf8b)
Solutions
- Verify the component with that ID is added to the trader/system before state loading runs
- Ensure the type parameter `T` matches the concrete registered type of the component
- Check for ID renames or config changes between the state-saving run and the restoring run; map or migrate old IDs
- Fix any initialization failure that prevented the component from registering, then retry restoration
Defensive patterns
Strategy: type-guard
Validate before calling
// before restoring, confirm the component is registered
if !trader.is_registered(&component_id) {
skip_or_register(component_id);
} Type guard
fn is_component_registered<T: DataActor>(trader: &Trader, id: &ComponentId) -> bool {
trader.try_get_actor::<T>(id).is_some()
} Try / catch
match trader.load_state() {
Err(e) if e.to_string().contains("not found in actor registry") => {
// reconcile saved component IDs with the current system config
}
other => other?,
} Prevention
- Keep the system config stable between the state-saving and restoring runs
- Register all persisted components before invoking state loading
- Map old component IDs to new ones after renames
- Pass the correct concrete type when using the typed loader
When it happens
Trigger: Calling state restore with a `PersistedComponentState` whose `component_id` does not resolve to a registered actor of type `T` — the component was never added, was already disposed, or the requested type does not match the registered concrete type.
Common situations: Restoring a saved-state snapshot into a system configured with fewer/different components; renamed actor IDs between runs; custom persistence code calling the typed loader with the wrong `T`; restart after the component failed to initialize.
Understand the failure class
Background: "Not found" and "does not exist" errors: why "Task not found", "No such folder", and "Can't find" fire when a lookup comes back empty — this error's family across 14 libraries.
Related errors
- Active execution intent {intent_id} was not found
- Actor for {id} not found
- Actor type mismatch for '{id}': expected {expected_type:?},
- RPC block feed active without an RPC client
- Pool {pool_identifier} is not registered
AI-assisted analysis of nautechsystems/nautilus_trader@18893faf8b (2026-09-08).
Data as JSON: /api/errors/aee125bbb318a086.
Report an issue: GitHub.