nautechsystems/nautilus_trader · error

Cannot start strategy, {strategy_id} not found

Error message

Cannot start strategy, {strategy_id} not found

What it means

start_strategy was called with a StrategyId that is not in the trader's registered strategy set; the strategy was never added (or was already removed), so there is no component to start and the call fails fast.

Source

Thrown at crates/system/src/trader.rs:1336

            anyhow::bail!("Cannot remove actor, {actor_id} not found");
        }

        // Stop if running, then dispose
        let _ = stop_component(&actor_id.inner());
        self.retire_actor(*actor_id)?;

        log::info!("Removed actor {actor_id} from trader {}", self.trader_id);
        Ok(())
    }

    /// Starts the strategy with the given `strategy_id`.
    ///
    /// # Errors
    ///
    /// 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

View on GitHub (pinned to 18893faf8b)

Solutions

  1. Add the strategy to the trader before starting it
  2. Check the strategy ID spelling against the registered strategies
Defensive patterns

Strategy: validation

When it happens

Trigger: Thrown at crates/system/src/trader.rs:1336 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/5f855c94bfab3bdf. Report an issue: GitHub.