nautechsystems/nautilus_trader · error

Nautilus `{other:?}` has no Lighter order-type equivalent

Error message

Nautilus `{other:?}` has no Lighter order-type equivalent

What it means

Converting a Nautilus `OrderType` to a Lighter order type (`TryFrom<OrderType>`) fails for Nautilus order types Lighter does not support — e.g. LimitIfTouched/MarketIfTouched variants beyond the mapped ones, StopLimitTrailing, trailing-stop types, and any other unlisted variant. Only Limit, Market, StopMarket, StopLimit, MarketIfTouched, and LimitIfTouched map.

Source

Thrown at crates/adapters/lighter/src/common/enums.rs:648

            Self::Twap | Self::TwapSub | Self::Liquidation => Err(anyhow::anyhow!(
                "Lighter `{self:?}` has no Nautilus order-type equivalent",
            )),
        }
    }
}

impl TryFrom<OrderType> for LighterOrderType {
    type Error = anyhow::Error;

    fn try_from(value: OrderType) -> Result<Self, Self::Error> {
        match value {
            OrderType::Limit => Ok(Self::Limit),
            OrderType::Market => Ok(Self::Market),
            OrderType::StopMarket => Ok(Self::StopLoss),
            OrderType::StopLimit => Ok(Self::StopLossLimit),
            OrderType::MarketIfTouched => Ok(Self::TakeProfit),
            OrderType::LimitIfTouched => Ok(Self::TakeProfitLimit),
            other => Err(anyhow::anyhow!(
                "Nautilus `{other:?}` has no Lighter order-type equivalent",
            )),
        }
    }
}

/// Lighter time-in-force as encoded in the venue's binary order payload.
#[derive(
    Copy, Clone, Debug, Display, PartialEq, Eq, Hash, AsRefStr, Serialize_repr, Deserialize_repr,
)]
#[repr(u8)]
pub enum LighterTimeInForce {
    /// Immediate-or-cancel.
    ImmediateOrCancel = 0,
    /// Good-till-time.
    GoodTillTime = 1,
    /// Post-only.
    PostOnly = 2,

View on GitHub (pinned to 18893faf8b)

Solutions

  1. Restrict strategy order types to Limit, Market, StopMarket, StopLimit, MarketIfTouched, and LimitIfTouched on Lighter.
  2. Emulate unsupported types (e.g. trailing stops) in the strategy with periodic stop re-pricing.
  3. Add an early check of `order_type` and log/skip unsupported submissions rather than failing mid-dispatch.

Example fix

// before
client.send_order(&order_with_trailing_stop)?;
// after
ensure!(matches!(order.order_type(), OrderType::Limit | OrderType::Market | OrderType::StopMarket | OrderType::StopLimit | OrderType::MarketIfTouched | OrderType::LimitIfTouched), "Lighter supports only basic/conditional order types");
client.send_order(&order)?;
Defensive patterns

Strategy: validation

Validate before calling

const SUPPORTED: &[OrderType] = &[OrderType::Limit, OrderType::Market, OrderType::StopMarket, OrderType::StopLimit, OrderType::MarketIfTouched, OrderType::LimitIfTouched];
assert!(SUPPORTED.contains(&order.order_type()), "Lighter does not support {:?}", order.order_type());

Type guard

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

Try / catch

let lighter_type = LighterOrderType::try_from(order.order_type())
    .map_err(|e| { log::error!("cannot submit to Lighter: {e}"); e })?;

Prevention

When it happens

Trigger: Submitting a Nautilus order whose `order_type` is not one of the six supported types, e.g. a trailing-stop order or `OrderType::StopLimitTrailing`, through the Lighter execution client.

Common situations: Strategies written for venues that support trailing stops or advanced conditional orders being run against Lighter; submitting bracket/OCO orders whose legs use unsupported types.

Related errors


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