nautechsystems/nautilus_trader · critical

Failed during trader startup: {start_err}; failed to stop pa

Error message

Failed during trader startup: {start_err}; failed to stop partial trader start: {stop_err}; failed to finalize startup abort: {finalize_err}

What it means

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.

Source

Thrown at crates/live/src/node/mod.rs:2335

        &mut self,
        start_err: anyhow::Error,
    ) -> anyhow::Result<()> {
        log::info!("Trader startup failed, aborting startup");
        self.handle.set_shutting_down();
        let stop_result = self.kernel.stop_trader_after_start_failure();
        let finalize_result = self.finalize_stop().await;

        match (stop_result, finalize_result) {
            (Ok(()), Ok(())) => Err(start_err),
            (Err(stop_err), Ok(())) => anyhow::bail!(
                "Failed during trader startup: {start_err}; failed to stop partial trader start: \
                 {stop_err}"
            ),
            (Ok(()), Err(finalize_err)) => anyhow::bail!(
                "Failed during trader startup: {start_err}; failed to finalize startup abort: \
                 {finalize_err}"
            ),
            (Err(stop_err), Err(finalize_err)) => anyhow::bail!(
                "Failed during trader startup: {start_err}; failed to stop partial trader start: \
                 {stop_err}; failed to finalize startup abort: {finalize_err}"
            ),
        }
    }

    fn initiate_shutdown(&mut self) {
        #[cfg(feature = "plugin")]
        if let Err(e) = self.plugins.stop_controllers() {
            log::error!("Error stopping plug-in controllers: {e}");
        }
        self.kernel.stop_trader();
        let delay = self.kernel.delay_post_stop();
        log::info!("Awaiting residual events ({delay:?})...");

        self.shutdown_deadline = Some(dst::time::Instant::now() + delay);
        self.handle.set_shutting_down();
    }

View on GitHub (pinned to 18893faf8b)

Solutions

  1. Start with the first error segment — the original startup failure is the root cause
  2. Then address 'failed to stop partial trader start' — likely a stuck component
  3. Then address 'failed to finalize startup abort' — finalization step failures
  4. If cascade persists, restart the process and add per-step logging to isolate which subsystem is unhealthy
Defensive patterns

Strategy: try-catch

Try / catch

match node.start().await {
    Err(e) if e.to_string().matches("failed to").count() >= 2 => {
        tracing::error!(error = %e, "cascading startup+cleanup failure — restart process");
    }
    Err(e) => return Err(e),
    Ok(()) => {},
}

Prevention

When it happens

Trigger: 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.

Common situations: 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.

Understand the failure class

Background: "This is a bug, please report it": internal invariant violations, unreachable panics, and SNH errors explained — this error's family across 47 libraries.

Related errors


AI-assisted analysis of nautechsystems/nautilus_trader@18893faf8b (2026-09-08). Data as JSON: /api/errors/c4e7a7c55e562ba8. Report an issue: GitHub.