nautechsystems/nautilus_trader · error · anyhow::Error

`bbo_side_type` and `bbo_level` are not supported for order

Error message

`bbo_side_type` and `bbo_level` are not supported for order type {order_type:?}

What it means

BBO trigger parameters only make sense for limit-style orders. validate_bbo_params allows only Limit, StopLimit, and LimitIfTouched; any other OrderType (e.g. Market, StopMarket) with bbo params set fails this ensure! check.

Source

Thrown at crates/adapters/bybit/src/execution.rs:574

    fn validate_bbo_params(
        order: &OrderAny,
        product_type: BybitProductType,
        tp_sl: &BybitTpSlParams,
    ) -> anyhow::Result<()> {
        if !tp_sl.has_bbo() {
            return Ok(());
        }

        anyhow::ensure!(
            matches!(
                product_type,
                BybitProductType::Linear | BybitProductType::Inverse
            ),
            "`bbo_side_type` and `bbo_level` are only supported for Bybit linear and inverse products"
        );

        let order_type = order.order_type();
        anyhow::ensure!(
            matches!(
                order_type,
                OrderType::Limit | OrderType::StopLimit | OrderType::LimitIfTouched
            ),
            "`bbo_side_type` and `bbo_level` are not supported for order type {order_type:?}"
        );

        Ok(())
    }

    fn build_ws_place_params(
        order: &OrderAny,
        product_type: BybitProductType,
        raw_symbol: &str,
        tp_sl: &BybitTpSlParams,
        position_idx: Option<BybitPositionIdx>,
        smp_type: Option<BybitOrderSmpType>,
    ) -> anyhow::Result<BybitWsPlaceOrderParams> {

View on GitHub (pinned to 18893faf8b)

Solutions

  1. Switch the order to OrderType::Limit, StopLimit, or LimitIfTouched
  2. Drop the bbo_side_type/bbo_level keys for market-style orders
  3. Gate BBO params behind order type in your submission code

Example fix

// before
order_builder.order_type(OrderType::Market).tp_sl(tp_sl_with_bbo);
// after
order_builder.order_type(OrderType::Limit).tp_sl(tp_sl_with_bbo);
Defensive patterns

Strategy: validation

Validate before calling

let bbo_allowed = matches!(order.order_type(),
    OrderType::Limit | OrderType::StopLimit | OrderType::LimitIfTouched);
if tp_sl.has_bbo() && !bbo_allowed {
    // remove BBO params or change order type before submission
}

Try / catch

if let Err(e) = validate_bbo_params(product_type, &order, &tp_sl) {
    if e.to_string().contains("order type") {
        tracing::warn!("dropping BBO params for {:?}", order.order_type());
        tp_sl.bbo_side_type = None;
        tp_sl.bbo_level = None;
    } else {
        return Err(e);
    }
}

Prevention

When it happens

Trigger: Attaching bbo_side_type/bbo_level to a Market, StopMarket, or MarketIfTouched order.

Common situations: Copy-pasting a BBO params builder across order builders; changing an order from Limit to Market while keeping BBO params.

Understand the failure class

Background: UnsupportedOperationException and "is not supported" errors: when a library deliberately refuses a call — this error's family across 30 libraries.

Related errors


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