nautechsystems/nautilus_trader · error

unsupported trigger order type for Derive: {other:?}; suppor

Error message

unsupported trigger order type for Derive: {other:?}; supported types are StopMarket, StopLimit, MarketIfTouched, and LimitIfTouched

What it means

Derive trigger orders only support four Nautilus order types: StopMarket, StopLimit, MarketIfTouched, and LimitIfTouched (mapped to Derive Market or Limit child orders). `trigger_order_type_to_derive` rejects any other OrderType passed as a trigger order.

Source

Thrown at crates/adapters/derive/src/common/parse.rs:137

/// Returns an error for order types Derive does not accept.
pub fn order_type_to_derive(order_type: OrderType) -> anyhow::Result<DeriveOrderType> {
    match order_type {
        OrderType::Limit => Ok(DeriveOrderType::Limit),
        OrderType::Market => Ok(DeriveOrderType::Market),
        other => anyhow::bail!("unsupported order type for Derive: {other:?}"),
    }
}

/// Maps a supported Nautilus trigger order type to the child Derive order type.
///
/// # Errors
///
/// Returns an error for order types not supported by Derive trigger orders.
pub fn trigger_order_type_to_derive(order_type: OrderType) -> anyhow::Result<DeriveOrderType> {
    match order_type {
        OrderType::StopMarket | OrderType::MarketIfTouched => Ok(DeriveOrderType::Market),
        OrderType::StopLimit | OrderType::LimitIfTouched => Ok(DeriveOrderType::Limit),
        other => anyhow::bail!(
            "unsupported trigger order type for Derive: {other:?}; supported types are StopMarket, StopLimit, MarketIfTouched, and LimitIfTouched"
        ),
    }
}

/// Maps a Nautilus trigger order type to Derive's stop-loss/take-profit flag.
///
/// # Errors
///
/// Returns an error for order types not supported by Derive trigger orders.
pub fn trigger_type_to_derive(order_type: OrderType) -> anyhow::Result<DeriveTriggerType> {
    match order_type {
        OrderType::StopMarket | OrderType::StopLimit => Ok(DeriveTriggerType::Stoploss),
        OrderType::MarketIfTouched | OrderType::LimitIfTouched => Ok(DeriveTriggerType::Takeprofit),
        other => anyhow::bail!(
            "unsupported trigger order type for Derive: {other:?}; supported types are StopMarket, StopLimit, MarketIfTouched, and LimitIfTouched"
        ),
    }

View on GitHub (pinned to 18893faf8b)

Solutions

  1. Restrict Derive trigger orders to StopMarket, StopLimit, MarketIfTouched, or LimitIfTouched
  2. Call `validate_trigger_order_support` before submission to fail fast with a clear message
  3. Use `order_type_to_derive` + plain payload path for non-trigger Limit/Market orders instead

Example fix

// before
let t = trigger_order_type_to_derive(OrderType::TrailingStopMarket)?; // errors
// after
let t = trigger_order_type_to_derive(OrderType::StopMarket)?; // supported
Defensive patterns

Strategy: validation

Validate before calling

fn is_derive_trigger_type(t: OrderType) -> bool {
    matches!(t, OrderType::StopMarket | OrderType::StopLimit | OrderType::MarketIfTouched | OrderType::LimitIfTouched)
}

Type guard

fn is_derive_trigger_type(t: OrderType) -> bool {
    matches!(t, OrderType::StopMarket | OrderType::StopLimit | OrderType::MarketIfTouched | OrderType::LimitIfTouched)
}

Try / catch

match trigger_order_type_to_derive(order.order_type()) {
    Ok(t) => { /* build trigger payload */ }
    Err(e) => tracing::warn!(%e, "order type not eligible as Derive trigger"),
}

Prevention

When it happens

Trigger: Building a Derive trigger payload (`trigger_order_to_derive_payload`) or validating trigger support (`validate_trigger_order_support`) with a Nautilus order type outside the supported four — e.g. a TrailingStopMarket or a plain Limit passed to the trigger path.

Common situations: Strategies that use trailing stops or exotic conditional orders being routed to Derive; generic order-construction helpers that pass arbitrary order types into the trigger conversion; misunderstanding that only stop/touch orders qualify as Derive triggers.

Related errors


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