nautechsystems/nautilus_trader · error
Cannot stop strategy, {strategy_id} not found
Error message
Cannot stop strategy, {strategy_id} not found What it means
stop_strategy was called with a StrategyId that is not in the trader's registered strategy set; the strategy was never added or has already been removed, so there is no running component to stop and the call fails fast.
Source
Thrown at crates/system/src/trader.rs:1351
/// Returns an error if the strategy is not registered or cannot be started.
pub fn start_strategy(&self, strategy_id: &StrategyId) -> anyhow::Result<()> {
if !self.strategy_ids.contains(strategy_id) {
anyhow::bail!("Cannot start strategy, {strategy_id} not found");
}
start_component(&strategy_id.inner())
}
/// Stops the strategy with the given `strategy_id`.
///
/// Respects the `manage_stop` behavior - if the strategy's stop function
/// returns `false`, the component stop is deferred until market exit completes.
///
/// # Errors
///
/// Returns an error if the strategy is not registered or cannot be stopped.
pub fn stop_strategy(&mut self, strategy_id: &StrategyId) -> anyhow::Result<()> {
if !self.strategy_ids.contains(strategy_id) {
anyhow::bail!("Cannot stop strategy, {strategy_id} not found");
}
let should_proceed = self
.strategy_stop_fns
.get_mut(strategy_id)
.is_none_or(|stop_fn| stop_fn());
if should_proceed {
stop_component(&strategy_id.inner())?;
}
Ok(())
}
/// Exits the market for the strategy with the given `strategy_id`.
///
/// Sends a strategy command to the strategy's control endpoint. The strategy
/// then performs its own managed market exit.View on GitHub (pinned to 18893faf8b)
Solutions
- Register the strategy before stopping it
- Verify the strategy ID against the trader's registered strategy IDs
Defensive patterns
Strategy: validation
When it happens
Trigger: Thrown at crates/system/src/trader.rs:1351 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/f72afa856efbc5b9.
Report an issue: GitHub.