nautechsystems/nautilus_trader · error
Failed to stop trader components: {stop_err}; failed to comp
Error message
Failed to stop trader components: {stop_err}; failed to complete trader stop: {transition_err} What it means
Composite failure in stop_after_start_failure: stopping the trader's components failed and the final trader stop transition also failed; all components still receive a stop attempt, but both errors are surfaced.
Source
Thrown at crates/system/src/trader.rs:1121
/// Stops a partially started trader without deferring managed strategy shutdown.
///
/// # Errors
///
/// Returns an error if the trader transition or any component stop fails. All registered
/// components still receive a stop attempt before the error is returned.
pub fn stop_after_start_failure(&mut self) -> anyhow::Result<()> {
self.transition_state(ComponentTrigger::Stop)?;
let stop_result = self.stop_components_after_start_failure();
let clock = self.clock_factory.clock();
self.ts_stopped = Some(clock.borrow().timestamp_ns());
let transition_result = self.transition_state(ComponentTrigger::StopCompleted);
match (stop_result, transition_result) {
(Ok(()), Ok(())) => Ok(()),
(Err(stop_err), Ok(())) => Err(stop_err),
(Ok(()), Err(transition_err)) => Err(transition_err),
(Err(stop_err), Err(transition_err)) => anyhow::bail!(
"Failed to stop trader components: {stop_err}; failed to complete trader stop: \
{transition_err}"
),
}
}
fn stop_components_after_start_failure(&mut self) -> anyhow::Result<()> {
let mut errors = Vec::new();
for actor_id in &self.actor_ids {
log::debug!("Stopping actor {actor_id} after startup failure");
if let Err(e) = Self::stop_component_if_active(actor_id.inner()) {
errors.push(format!("actor {actor_id}: {e:#}"));
}
}
for exec_algorithm_id in self.exec_algorithm_ids.clone() {
log::debug!("Stopping execution algorithm {exec_algorithm_id} after startup failure");View on GitHub (pinned to 18893faf8b)
Solutions
- Inspect the component stop errors and the transition error independently
- Force-dispose components manually if the stop transition failed
Defensive patterns
Strategy: try-catch
When it happens
Trigger: Thrown at crates/system/src/trader.rs:1121 when the library encounters an invalid state.
Common situations: See trigger scenarios.
AI-assisted analysis of nautechsystems/nautilus_trader@18893faf8b (2026-09-08).
Data as JSON: /api/errors/168b7877a0a4debf.
Report an issue: GitHub.