{"record":{"id":"8aaf84331b3fd9e8","repo":"nautechsystems/nautilus_trader","slug":"failed-during-trader-startup-start-err-failed","errorCode":null,"errorMessage":"Failed during trader startup: {start_err}; failed to stop partial trader start: {stop_err}","messagePattern":"Failed during trader startup: (.+?); failed to stop partial trader start: (.+?)","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"crates/live/src/node/mod.rs","lineNumber":2327,"sourceCode":"                }\n            }\n        }\n\n        processed\n    }\n\n    async fn abort_after_trader_start_failure(\n        &mut self,\n        start_err: anyhow::Error,\n    ) -> anyhow::Result<()> {\n        log::info!(\"Trader startup failed, aborting startup\");\n        self.handle.set_shutting_down();\n        let stop_result = self.kernel.stop_trader_after_start_failure();\n        let finalize_result = self.finalize_stop().await;\n\n        match (stop_result, finalize_result) {\n            (Ok(()), Ok(())) => Err(start_err),\n            (Err(stop_err), Ok(())) => anyhow::bail!(\n                \"Failed during trader startup: {start_err}; failed to stop partial trader start: \\\n                 {stop_err}\"\n            ),\n            (Ok(()), Err(finalize_err)) => anyhow::bail!(\n                \"Failed during trader startup: {start_err}; failed to finalize startup abort: \\\n                 {finalize_err}\"\n            ),\n            (Err(stop_err), Err(finalize_err)) => anyhow::bail!(\n                \"Failed during trader startup: {start_err}; failed to stop partial trader start: \\\n                 {stop_err}; failed to finalize startup abort: {finalize_err}\"\n            ),\n        }\n    }\n\n    fn initiate_shutdown(&mut self) {\n        #[cfg(feature = \"plugin\")]\n        if let Err(e) = self.plugins.stop_controllers() {\n            log::error!(\"Error stopping plug-in controllers: {e}\");","sourceCodeStart":2309,"sourceCodeEnd":2345,"githubUrl":"https://github.com/nautechsystems/nautilus_trader/blob/18893faf8b356be3320add8de2f861b0b647cf06/crates/live/src/node/mod.rs#L2309-L2345","documentation":"When trader startup fails after the trader already started, abort_after_trader_start_failure stops the partial trader (stop_trader_after_start_failure) and finalizes the stop. If stopping the partial trader fails while finalize succeeds, the original start error is chained with 'failed to stop partial trader start: {stop_err}'.","triggerScenarios":"start or run_with_mode hits a startup error after trader start began; the subsequent kernel.stop_trader_after_start_failure() returns Err while finalize_stop() returns Ok.","commonSituations":"A strategy or actor panics/errors mid-start and the partial trader cannot be stopped cleanly (component in unexpected state), while overall shutdown finalization succeeds.","solutions":["Fix the primary startup error (first part of the message)","Investigate why stop_trader_after_start_failure failed — usually a component stuck in a non-stoppable state","Check component states/logs of the partially started trader","Retry after fixing; ensure no duplicate start calls on the same node"],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":null,"typeGuard":null,"tryCatchPattern":"if let Err(e) = node.start().await {\n    if e.to_string().contains(\"failed to stop partial trader start\") {\n        tracing::error!(error = %e, \"partial trader could not be stopped cleanly\");\n    }\n    return Err(e);\n}","preventionTips":["Ensure all components implement stop correctly and reach a stoppable state","Test startup-failure paths in CI with failing adapters","Avoid panics inside actor/strategy start hooks"],"tags":["rust","startup","live-node","partial-start","error-chaining"],"backgroundTag":"internal-invariant-violation","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"}