nautechsystems/nautilus_trader · error

{}

Error message

{}

What it means

Kernel::start_trader collects all errors that occur while starting the trader and its components; if starting the trader fails partway, it also attempts to stop the partial start and save state, appending any secondary errors. All accumulated errors are joined with '; ' and returned as a single anyhow error whose message is exactly that joined string. The dynamic '{}' message therefore contains every failure from the start sequence.

Source

Thrown at crates/system/src/kernel.rs:815

        }

        self.state_save_armed = save_state;
        self.order_emulator.start();

        if let Err(start_err) = Trader::start_with_component_callbacks(&self.trader) {
            let stop_result = self.stop_trader_after_start_failure();
            self.order_emulator.stop();
            let save_result = self.save_trader_state();

            let mut errors = vec![format!("Failed to start trader: {start_err}")];
            if let Err(e) = stop_result {
                errors.push(format!("failed to stop partial trader start: {e}"));
            }

            if let Err(e) = save_result {
                errors.push(format!("failed to save partial trader state: {e}"));
            }
            anyhow::bail!("{}", errors.join("; "));
        }

        log::info!("Trader started");
        Ok(())
    }

    /// Stops the trader and its registered components.
    ///
    /// This method initiates a graceful shutdown of trading components (strategies, actors)
    /// which may trigger residual events such as order cancellations. The caller should
    /// continue processing events after calling this method to handle these residual events.
    pub fn stop_trader(&mut self) {
        disarm_shutdown_on_error();

        if !self.trader.borrow().is_running() {
            return;
        }

View on GitHub (pinned to 18893faf8b)

Solutions

  1. Read the joined message and address the first error — that is the root cause of the partial start
  2. Fix the failing component identified in the first error (credentials, connectivity, config)
  3. Re-run; if secondary errors persist, fix stopping/saving problems after the root cause is resolved
  4. Check logs preceding the error for the component-level stack trace
Defensive patterns

Strategy: try-catch

Validate before calling

// Pre-validate components before starting the trader
for client in clients {
    anyhow::ensure!(client.is_connected(), "client {} not connected before start", client.id());
}

Try / catch

match kernel.start_trader().await {
    Err(e) => {
        // message may join multiple failures with '; ' — split and log each
        for part in e.to_string().split("; ") {
            log::error!("start failure: {part}");
        }
    }
    Ok(()) => {}
}

Prevention

When it happens

Trigger: Any failure during trader start (client registration failures, engine start errors, data or execution client connect failures), especially when the rollback stop/save also produces errors, yielding a compound message.

Common situations: Misconfigured client credentials or venue connectivity during live start; an engine failing to initialize causing partial-start rollback; disk issues making the partial-state save fail and adding a second error to the message.

Understand the failure class

Background: "Invalid state transition" errors: "status must be X, actually Y", "already rejected/charging/uninstalled", "cannot ... while running" — what they mean when a library rejects your call — this error's family across 31 libraries.

Related errors


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