nautechsystems/nautilus_trader · error

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}

What it means

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}'.

Source

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

                }
            }
        }

        processed
    }

    async fn abort_after_trader_start_failure(
        &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}");

View on GitHub (pinned to 18893faf8b)

Solutions

  1. Fix the primary startup error (first part of the message)
  2. Investigate why stop_trader_after_start_failure failed — usually a component stuck in a non-stoppable state
  3. Check component states/logs of the partially started trader
  4. Retry after fixing; ensure no duplicate start calls on the same node
Defensive patterns

Strategy: try-catch

Try / catch

if let Err(e) = node.start().await {
    if e.to_string().contains("failed to stop partial trader start") {
        tracing::error!(error = %e, "partial trader could not be stopped cleanly");
    }
    return Err(e);
}

Prevention

When it happens

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

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

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/8aaf84331b3fd9e8. Report an issue: GitHub.