{"record":{"id":"95f36486b1ce26af","repo":"nautechsystems/nautilus_trader","slug":"nautilus-other-has-no-lighter-order-type-equ","errorCode":null,"errorMessage":"Nautilus `{other:?}` has no Lighter order-type equivalent","messagePattern":"Nautilus `(.+?)` has no Lighter order-type equivalent","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"crates/adapters/lighter/src/common/enums.rs","lineNumber":648,"sourceCode":"            Self::Twap | Self::TwapSub | Self::Liquidation => Err(anyhow::anyhow!(\n                \"Lighter `{self:?}` has no Nautilus order-type equivalent\",\n            )),\n        }\n    }\n}\n\nimpl TryFrom<OrderType> for LighterOrderType {\n    type Error = anyhow::Error;\n\n    fn try_from(value: OrderType) -> Result<Self, Self::Error> {\n        match value {\n            OrderType::Limit => Ok(Self::Limit),\n            OrderType::Market => Ok(Self::Market),\n            OrderType::StopMarket => Ok(Self::StopLoss),\n            OrderType::StopLimit => Ok(Self::StopLossLimit),\n            OrderType::MarketIfTouched => Ok(Self::TakeProfit),\n            OrderType::LimitIfTouched => Ok(Self::TakeProfitLimit),\n            other => Err(anyhow::anyhow!(\n                \"Nautilus `{other:?}` has no Lighter order-type equivalent\",\n            )),\n        }\n    }\n}\n\n/// Lighter time-in-force as encoded in the venue's binary order payload.\n#[derive(\n    Copy, Clone, Debug, Display, PartialEq, Eq, Hash, AsRefStr, Serialize_repr, Deserialize_repr,\n)]\n#[repr(u8)]\npub enum LighterTimeInForce {\n    /// Immediate-or-cancel.\n    ImmediateOrCancel = 0,\n    /// Good-till-time.\n    GoodTillTime = 1,\n    /// Post-only.\n    PostOnly = 2,","sourceCodeStart":630,"sourceCodeEnd":666,"githubUrl":"https://github.com/nautechsystems/nautilus_trader/blob/18893faf8b356be3320add8de2f861b0b647cf06/crates/adapters/lighter/src/common/enums.rs#L630-L666","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","solutions":["Restrict strategy order types to Limit, Market, StopMarket, StopLimit, MarketIfTouched, and LimitIfTouched on Lighter.","Emulate unsupported types (e.g. trailing stops) in the strategy with periodic stop re-pricing.","Add an early check of `order_type` and log/skip unsupported submissions rather than failing mid-dispatch."],"exampleFix":"// before\nclient.send_order(&order_with_trailing_stop)?;\n// after\nensure!(matches!(order.order_type(), OrderType::Limit | OrderType::Market | OrderType::StopMarket | OrderType::StopLimit | OrderType::MarketIfTouched | OrderType::LimitIfTouched), \"Lighter supports only basic/conditional order types\");\nclient.send_order(&order)?;","handlingStrategy":"validation","validationCode":"const SUPPORTED: &[OrderType] = &[OrderType::Limit, OrderType::Market, OrderType::StopMarket, OrderType::StopLimit, OrderType::MarketIfTouched, OrderType::LimitIfTouched];\nassert!(SUPPORTED.contains(&order.order_type()), \"Lighter does not support {:?}\", order.order_type());","typeGuard":"fn lighter_supported(t: OrderType) -> bool {\n    matches!(t, OrderType::Limit | OrderType::Market | OrderType::StopMarket | OrderType::StopLimit | OrderType::MarketIfTouched | OrderType::LimitIfTouched)\n}","tryCatchPattern":"let lighter_type = LighterOrderType::try_from(order.order_type())\n    .map_err(|e| { log::error!(\"cannot submit to Lighter: {e}\"); e })?;","preventionTips":["Restrict strategies running on Lighter to the six supported order types.","Emulate trailing stops/advanced conditionals in strategy logic.","Add a pre-trade order-type assertion in the strategy or a routing check."],"tags":["order-type","mapping","lighter","unsupported"],"backgroundTag":"unsupported-enum-value","analyzedSha":"18893faf8b356be3320add8de2f861b0b647cf06","analyzedAt":"2026-09-08T20:49:34.690Z","contentChangedAt":"2026-09-08T20:49:34.690Z","schemaVersion":2},"datasetVersion":"2026-09-14T05:17:10.506Z"}