{"record":{"id":"7ba266127fb94949","repo":"nautechsystems/nautilus_trader","slug":"failed-to-start-strategy-strategy-id-start-err","errorCode":null,"errorMessage":"Failed to start strategy {strategy_id}: {start_err}; rollback failed: {rollback_err}","messagePattern":"Failed to start strategy (.+?): (.+?); rollback failed: (.+?)","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"critical","filePath":"crates/system/src/controller.rs","lineNumber":356,"sourceCode":"        actor_id: ActorId,\n        start_err: anyhow::Error,\n    ) -> anyhow::Error {\n        match self.remove_actor(&actor_id) {\n            Ok(()) => start_err,\n            Err(rollback_err) => anyhow::anyhow!(\n                \"Failed to start actor {actor_id}: {start_err}; rollback failed: {rollback_err}\"\n            ),\n        }\n    }\n\n    fn rollback_strategy_start_failure(\n        &self,\n        strategy_id: StrategyId,\n        start_err: anyhow::Error,\n    ) -> anyhow::Error {\n        match self.remove_strategy(&strategy_id) {\n            Ok(()) => start_err,\n            Err(rollback_err) => anyhow::anyhow!(\n                \"Failed to start strategy {strategy_id}: {start_err}; rollback failed: {rollback_err}\"\n            ),\n        }\n    }\n\n    fn register_execute_endpoint(&self) {\n        let controller_id = self.core.actor_id().inner();\n        let handler = TypedHandler::from(move |command: &ControllerCommand| {\n            if let Some(mut controller) = try_get_actor_unchecked::<Self>(&controller_id) {\n                if let Err(e) = controller.execute(command.clone()) {\n                    log::error!(\"Controller command failed for {controller_id}: {e}\");\n                }\n            } else {\n                log::error!(\"Controller {controller_id} not found for command handling\");\n            }\n        });\n\n        get_message_bus()","sourceCodeStart":338,"sourceCodeEnd":374,"githubUrl":"https://github.com/nautechsystems/nautilus_trader/blob/18893faf8b356be3320add8de2f861b0b647cf06/crates/system/src/controller.rs#L338-L374","documentation":"Analogous to the actor variant: when a strategy fails to start, the controller rolls back by removing the strategy via remove_strategy. If that rollback also fails, both the original start error and the rollback error are combined into this message naming the StrategyId.","triggerScenarios":"start_created_strategy fails during strategy start (bad config, failed on_start handler), and remove_strategy then also errors because the strategy cannot be cleanly removed from the controller's registry.","commonSituations":"Strategy on_start panics or errors due to missing instruments/accounts, compounded by registry inconsistency; duplicate strategy IDs causing removal to fail; strategy stuck in a starting state that blocks removal.","solutions":["Address the original start error ({start_err} in the message) — it is the primary cause","Check why remove_strategy failed: duplicate registration, already-removed strategy, or a locked registry","Ensure strategy IDs are unique across the trading system config","Run the strategy in isolation with debug logging to isolate the start failure from the rollback failure"],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":"// before start_created_strategy\nassert!(!controller.has_strategy(&strategy_id), \"strategy {strategy_id} already registered\");","typeGuard":null,"tryCatchPattern":"match system.start() {\n    Err(e) if e.to_string().contains(\"rollback failed\") => {\n        log::error!(\"strategy start AND rollback failed — rebuild controller state: {e:#}\");\n    }\n    other => other?,\n}","preventionTips":["Enforce unique StrategyIds across the system config","Keep strategy removal idempotent so rollback cannot fail","Validate strategy dependencies (instruments, accounts) exist before start to avoid compounding failures"],"tags":["strategy","lifecycle","rollback","system-controller"],"backgroundTag":"invalid-state-transition","analyzedSha":"18893faf8b356be3320add8de2f861b0b647cf06","analyzedAt":"2026-09-08T20:49:34.690Z","contentChangedAt":"2026-09-08T20:49:34.690Z","schemaVersion":2},"datasetVersion":"2026-09-14T00:17:10.932Z"}