{"record":{"id":"7d5fc241b2e04fa2","repo":"nautechsystems/nautilus_trader","slug":"failed-while-starting-execution-algorithm-exec-al","errorCode":null,"errorMessage":"Failed while starting execution algorithm {exec_algorithm_id}: {start_err:#}; failed to roll back restored subscriptions: {cleanup_err:#}","messagePattern":"Failed while starting execution algorithm (.+?): (.+?); failed to roll back restored subscriptions: (.+?)","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"crates/system/src/trader.rs","lineNumber":1065,"sourceCode":"            }\n        }\n\n        if errors.is_empty() {\n            Ok(())\n        } else {\n            anyhow::bail!(\"{}\", errors.join(\"; \"))\n        }\n    }\n\n    fn exec_algorithm_start_error_with_rollback(\n        &mut self,\n        exec_algorithm_id: ExecAlgorithmId,\n        restored_exec_algorithm_ids: &[ExecAlgorithmId],\n        start_err: anyhow::Error,\n    ) -> anyhow::Error {\n        match self.cleanup_exec_algorithm_subscriptions_for(restored_exec_algorithm_ids) {\n            Ok(()) => start_err,\n            Err(cleanup_err) => anyhow::anyhow!(\n                \"Failed while starting execution algorithm {exec_algorithm_id}: {start_err:#}; \\\n                 failed to roll back restored subscriptions: {cleanup_err:#}\"\n            ),\n        }\n    }\n\n    /// Stops all registered components.\n    ///\n    /// # Errors\n    ///\n    /// Returns an error if any component fails to stop.\n    pub fn stop_components(&mut self) -> anyhow::Result<()> {\n        for actor_id in &self.actor_ids {\n            log::debug!(\"Stopping actor {actor_id}\");\n            Self::stop_component_if_active(actor_id.inner())?;\n        }\n\n        for exec_algorithm_id in &self.exec_algorithm_ids {","sourceCodeStart":1047,"sourceCodeEnd":1083,"githubUrl":"https://github.com/nautechsystems/nautilus_trader/blob/18893faf8b356be3320add8de2f861b0b647cf06/crates/system/src/trader.rs#L1047-L1083","documentation":"This error wraps a failure that occurred while starting an execution algorithm and additionally reports that the rollback of already-restored execution-algorithm subscriptions also failed. Both the original start error and the cleanup error are chained with `{:#}` formatting, so both root causes are visible.","triggerScenarios":"During `Trader.start_components`, an exec algorithm fails to start (its `start()` raises), and then `cleanup_exec_algorithm_subscriptions_for` also errors while unsubscribing/rolling back the subscriptions of the already-started exec algorithms.","commonSituations":"Exec algorithm start raising due to bad config or unregistered clients, combined with a poisoned/broken subscription state making rollback fail too; cache or message bus in an inconsistent state after a partial start.","solutions":["Read both chained errors: fix the original start failure first (usually the root cause)","Investigate why subscription cleanup failed (check message bus/client state and logs)","Restart the trader/node for a clean state before retrying","Add validation of exec algorithm config and registered clients before calling start"],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":null,"typeGuard":null,"tryCatchPattern":"try:\n    trader.start()\nexcept Exception as e:\n    logging.exception(\"start failed (check both start and rollback causes): %s\", e)\n    # inspect chained context for the root start error and cleanup error\n    raise","preventionTips":["Validate exec algorithm config and client availability before start","Avoid partial-start states by starting components in dependency order","Monitor logs for subscription cleanup warnings"],"tags":["exec-algorithm","rollback","system"],"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"}