nautechsystems/nautilus_trader · error
Cannot market exit strategy, {strategy_id} not found
Error message
Cannot market exit strategy, {strategy_id} not found What it means
Registration guard behind strategy_command_handler: market_exit_strategy needs a command handler for the strategy, but the strategy_id is not registered with the trader, so the exit-market command cannot be routed.
Source
Thrown at crates/system/src/trader.rs:1388
///
/// # Errors
///
/// Returns an error if the strategy is not registered or its control endpoint is missing.
pub fn market_exit_strategy(
trader: &Rc<RefCell<Self>>,
strategy_id: &StrategyId,
) -> anyhow::Result<()> {
let handler = trader.borrow().strategy_command_handler(*strategy_id)?;
handler.handle(&StrategyCommand::ExitMarket);
Ok(())
}
fn strategy_command_handler(
&self,
strategy_id: StrategyId,
) -> anyhow::Result<TypedHandler<StrategyCommand>> {
if !self.strategy_ids.contains(&strategy_id) {
anyhow::bail!("Cannot market exit strategy, {strategy_id} not found");
}
let endpoint = strategy_control_endpoint(strategy_id);
let handler = {
let msgbus = get_message_bus();
msgbus
.borrow_mut()
.endpoint_map::<StrategyCommand>()
.get(endpoint)
.cloned()
};
let Some(handler) = handler else {
anyhow::bail!(
"Cannot exit market for strategy {strategy_id}: control endpoint '{}' not registered",
endpoint.as_str()
);
};View on GitHub (pinned to 18893faf8b)
Solutions
- Register the strategy with the trader before issuing a market exit
- Verify the strategy ID is correct and currently registered
Defensive patterns
Strategy: validation
When it happens
Trigger: Thrown at crates/system/src/trader.rs:1388 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/8d5acf969674d92c.
Report an issue: GitHub.