{"record":{"id":"c4e7a7c55e562ba8","repo":"nautechsystems/nautilus_trader","slug":"failed-during-trader-startup-start-err-failed-c4e7a7","errorCode":null,"errorMessage":"Failed during trader startup: {start_err}; failed to stop partial trader start: {stop_err}; failed to finalize startup abort: {finalize_err}","messagePattern":"Failed during trader startup: (.+?); failed to stop partial trader start: (.+?); failed to finalize startup abort: (.+?)","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"critical","filePath":"crates/live/src/node/mod.rs","lineNumber":2335,"sourceCode":"        &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}\");\n        }\n        self.kernel.stop_trader();\n        let delay = self.kernel.delay_post_stop();\n        log::info!(\"Awaiting residual events ({delay:?})...\");\n\n        self.shutdown_deadline = Some(dst::time::Instant::now() + delay);\n        self.handle.set_shutting_down();\n    }","sourceCodeStart":2317,"sourceCodeEnd":2353,"githubUrl":"https://github.com/nautechsystems/nautilus_trader/blob/18893faf8b356be3320add8de2f861b0b647cf06/crates/live/src/node/mod.rs#L2317-L2353","documentation":"The most severe compound failure: trader startup failed, stopping the partial trader failed, AND finalize_stop failed. All three errors are chained into a single message so the developer can see the full cascade.","triggerScenarios":"start or run_with_mode fails during trader startup and both kernel.stop_trader_after_start_failure() and finalize_stop() return Err — the (Err(stop_err), Err(finalize_err)) match arm.","commonSituations":"Cascading failures such as a broken adapter/executor poisoning both the trader state and the shutdown path; often seen with panicking actors, dead connections, or a kernel already in an invalid state.","solutions":["Start with the first error segment — the original startup failure is the root cause","Then address 'failed to stop partial trader start' — likely a stuck component","Then address 'failed to finalize startup abort' — finalization step failures","If cascade persists, restart the process and add per-step logging to isolate which subsystem is unhealthy"],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":null,"typeGuard":null,"tryCatchPattern":"match node.start().await {\n    Err(e) if e.to_string().matches(\"failed to\").count() >= 2 => {\n        tracing::error!(error = %e, \"cascading startup+cleanup failure — restart process\");\n    }\n    Err(e) => return Err(e),\n    Ok(()) => {},\n}","preventionTips":["Exercise failure-injection tests for startup paths","Monitor component health so broken adapters are caught before start","On cascading failures, prefer full process restart over partial recovery"],"tags":["rust","startup","live-node","cascading-failure","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"}