nautechsystems/nautilus_trader · error

Cannot modify order in place: {} orders do not have a STOP t

Error message

Cannot modify order in place: {} orders do not have a STOP trigger price

What it means

When modifying an order in place with a trigger_price, the order must actually possess a STOP trigger price field (i.e. be a stop-type order). Orders whose type has no trigger price (e.g. plain LIMIT/MARKET) cannot accept one, so the call bails.

Source

Thrown at crates/trading/src/algorithm/mod.rs:1031

    {
        // Validate order status
        let status = order.status();
        if status != OrderStatus::Initialized && status != OrderStatus::Released {
            anyhow::bail!(
                "Cannot modify order in place: status is {status:?}, expected INITIALIZED or RELEASED"
            );
        }

        // Validate order type compatibility
        if price.is_some() && order.price().is_none() {
            anyhow::bail!(
                "Cannot modify order in place: {} orders do not have a LIMIT price",
                order.order_type()
            );
        }

        if trigger_price.is_some() && order.trigger_price().is_none() {
            anyhow::bail!(
                "Cannot modify order in place: {} orders do not have a STOP trigger price",
                order.order_type()
            );
        }

        // Check if any value would actually change
        let qty_changing = quantity.is_some_and(|q| q != order.quantity());
        let price_changing = price.is_some() && price != order.price();
        let trigger_changing = trigger_price.is_some() && trigger_price != order.trigger_price();

        if !qty_changing && !price_changing && !trigger_changing {
            anyhow::bail!("Cannot modify order in place: no parameters differ from current values");
        }

        let core = ExecutionAlgorithmNative::exec_algorithm_core_mut(self);
        let ts_now = core.clock_mut().timestamp_ns();

        let updated = OrderUpdated::new(

View on GitHub (pinned to 18893faf8b)

Solutions

  1. Only pass trigger_price for order types that support trigger prices (STOP_LIMIT, STOP_MARKET, etc.)
  2. Check order.trigger_price().is_some() before supplying a new trigger price
  3. Create a new order of the correct type instead of trying to add a trigger via modification
  4. Inspect order.order_type() and branch the modification logic accordingly

Example fix

// before
algo.modify_order_in_place(&mut order, None, None, Some(trigger))?;
// after
if order.trigger_price().is_some() {
    algo.modify_order_in_place(&mut order, None, None, Some(trigger))?;
}
Defensive patterns

Strategy: validation

Validate before calling

if trigger_price.is_some() && order.trigger_price().is_none() { return Err(anyhow!("order type {:?} has no trigger price", order.order_type())); }

Type guard

fn supports_trigger(o: &OrderAny) -> bool { o.trigger_price().is_some() }

Prevention

When it happens

Trigger: Calling modify_order_in_place(order, qty, price, Some(trigger_price)) on a non-stop order type such as Limit or Market.

Common situations: Generic modification code that always passes a trigger price; converting a limit order to a stop order via modify instead of creating a new order; misconfigured algorithm parameters supplying trigger prices for non-stop orders.

Understand the failure class

Background: "Must be a positive integer", "Invalid value", "Unsupported": the invalid-argument-value error family, when a library rejects the value you pass — this error's family across 35 libraries.

Related errors


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