{"record":{"id":"a93da8e1f8566daf","repo":"nautechsystems/nautilus_trader","slug":"actor-actor-id-state-callback-not-found","errorCode":null,"errorMessage":"Actor {actor_id} state callback not found","messagePattern":"Actor (.+?) state callback not found","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"crates/system/src/trader.rs","lineNumber":1673,"sourceCode":"            }\n        }\n\n        if errors.is_empty() {\n            Ok(())\n        } else {\n            anyhow::bail!(\"Failed to save component state: {}\", errors.join(\"; \"))\n        }\n    }\n\n    fn actor_state_callbacks(&self) -> anyhow::Result<Vec<(ActorId, ComponentStateCallbacks)>> {\n        self.actor_ids\n            .iter()\n            .map(|actor_id| {\n                self.actor_state_callbacks\n                    .get(actor_id)\n                    .copied()\n                    .map(|callbacks| (*actor_id, callbacks))\n                    .ok_or_else(|| anyhow::anyhow!(\"Actor {actor_id} state callback not found\"))\n            })\n            .collect()\n    }\n\n    fn strategy_state_callbacks(\n        &self,\n    ) -> anyhow::Result<Vec<(StrategyId, ComponentStateCallbacks)>> {\n        self.strategy_ids\n            .iter()\n            .map(|strategy_id| {\n                self.strategy_state_callbacks\n                    .get(strategy_id)\n                    .copied()\n                    .map(|callbacks| (*strategy_id, callbacks))\n                    .ok_or_else(|| {\n                        anyhow::anyhow!(\"Strategy {strategy_id} state callback not found\")\n                    })\n            })","sourceCodeStart":1655,"sourceCodeEnd":1691,"githubUrl":"https://github.com/nautechsystems/nautilus_trader/blob/18893faf8b356be3320add8de2f861b0b647cf06/crates/system/src/trader.rs#L1655-L1691","documentation":"Raised in `Trader::actor_state_callbacks` when building the set of state-save/load callbacks for state recovery: an actor ID was listed for recovery but no callbacks are registered for it in the trader's `actor_state_callbacks` map. This indicates an internal inconsistency — an actor is tracked for persistence without its callback pair.","triggerScenarios":"Calling trader start/state save when an actor_id present in the component registry (or persistence list) has no entry in `self.actor_state_callbacks` — e.g. the actor was added without state callbacks, or was removed while still referenced by the recovery list.","commonSituations":"Custom actor registration paths that skip `save()`/`load()` callback registration; modifying trader internals; a version mismatch where recovery metadata references actors registered differently in the current version.","solutions":["Register the actor's save/load state callbacks when adding it (or use the standard Actor registration path) so the map entry exists","Check whether the actor was added after `load_state` collected its ID and re-order initialization","If using custom trader plumbing, keep `actor_state_callbacks` in sync with registered actors","Report/inspect the specific `actor_id`; rebuild the trader config so only actors with state callbacks are included in recovery"],"exampleFix":null,"handlingStrategy":"validation","validationCode":"// ensure every actor listed for recovery has state callbacks registered\nfor id in recovery_actor_ids {\n    assert!(trader.has_actor_state_callbacks(&id), \"missing callbacks for {id}\");\n}","typeGuard":"fn has_state_callbacks(trader: &Trader, actor_id: &ActorId) -> bool {\n    trader.actor_state_callbacks().contains_key(actor_id)\n}","tryCatchPattern":null,"preventionTips":["Register actors only through the standard path that installs save/load callbacks","Keep recovery metadata derived from the same registration code as the callback map","Sync callback removal with actor removal in custom lifecycle code","Fail fast at config time if a recovery-listed actor lacks callbacks"],"tags":["actor","state","callback","registry"],"backgroundTag":"entity-not-found","analyzedSha":"18893faf8b356be3320add8de2f861b0b647cf06","analyzedAt":"2026-09-08T20:49:34.690Z","contentChangedAt":"2026-09-08T20:49:34.690Z","schemaVersion":2},"datasetVersion":"2026-09-14T05:17:10.506Z"}