{"record":{"id":"e30d471b2fcaabbb","repo":"nautechsystems/nautilus_trader","slug":"unsupported-nautilus-order-type-for-lighter-e","errorCode":null,"errorMessage":"unsupported Nautilus order type for Lighter: {e}","messagePattern":"unsupported Nautilus order type for Lighter: (.+?)","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"crates/adapters/lighter/src/websocket/dispatch.rs","lineNumber":2036,"sourceCode":"    match tif {\n        TimeInForce::Ioc => Ok(LighterTimeInForce::ImmediateOrCancel),\n        TimeInForce::Fok => anyhow::bail!(\n            \"Lighter has no fill-or-kill TIF; reject FOK at the strategy or use IOC explicitly\",\n        ),\n        TimeInForce::Gtc | TimeInForce::Day | TimeInForce::Gtd => {\n            Ok(LighterTimeInForce::GoodTillTime)\n        }\n        other => anyhow::bail!(\"Lighter does not support TimeInForce::{other:?}\"),\n    }\n}\n\n/// Translate a Nautilus [`OrderType`] into the venue's [`LighterOrderType`]\n/// discriminant for use in `CreateOrder` tx bodies.\npub(crate) fn nautilus_to_lighter_order_type(\n    order_type: OrderType,\n) -> anyhow::Result<LighterOrderType> {\n    LighterOrderType::try_from(order_type)\n        .map_err(|e| anyhow::anyhow!(\"unsupported Nautilus order type for Lighter: {e}\"))\n}\n\n/// Compute the venue-side `order_expiry` (millis) for a Nautilus order.\n///\n/// - `MARKET`: `ORDER_EXPIRY_IOC` (`0`) because it has no resting trigger\n///   lifetime.\n/// - Conditional orders: positive expiry from `GTD` or the default GTC window.\n///   Lighter uses `TimeInForce` as the post-trigger execution instruction,\n///   while `OrderExpiry` controls how long the trigger can rest.\n/// - `Gtd` with an explicit expire_time: the millisecond timestamp, provided\n///   it is within the venue's 5-minute to 30-day lifetime range.\n/// - `Ioc` / `Fok`: `ORDER_EXPIRY_IOC` (`0`): Lighter requires this exact\n///   value for IOC semantics; any other value is rejected by the sequencer.\n/// - `Gtc` / `Day` / `Gtd` without expiry: `now_ms + ORDER_EXPIRY_DEFAULT_GTC_MS`.\n///   The venue rejects `-1` for these TIFs with `21711 invalid expiry`.\npub(crate) fn order_expiry_for(\n    order_type: OrderType,\n    tif: &TimeInForce,","sourceCodeStart":2018,"sourceCodeEnd":2054,"githubUrl":"https://github.com/nautechsystems/nautilus_trader/blob/18893faf8b356be3320add8de2f861b0b647cf06/crates/adapters/lighter/src/websocket/dispatch.rs#L2018-L2054","documentation":"nautilus_to_lighter_order_type converts a Nautilus OrderType into a LighterOrderType discriminant; unsupported order types fail conversion and are wrapped in this error. Lighter only supports a subset of Nautilus order types for CreateOrder tx bodies.","triggerScenarios":"Submitting an order whose OrderType (e.g. STOP_LIMIT, TRAILING_STOP_MARKET, or other non-Lighter types) has no TryFrom<OrderType> mapping to LighterOrderType.","commonSituations":"Strategy code written for venues with rich order types being ported to Lighter; defaults emitting LIMIT only sometimes and STOP variants other times; version drift adding new Nautilus order types.","solutions":["Use only supported order types with Lighter: LIMIT and MARKET.","Emulate unsupported types client-side (e.g. manage stop triggers in the strategy and submit LIMIT/MARKET on trigger).","Check the LighterOrderType::try_from(OrderType) implementation for the exact supported set before submitting."],"exampleFix":"// before\norder_factory.limit(...) // or market(...) only for Lighter\n// after: unsupported\n// order_factory.stop_limit(...) -> error; replace with client-side trigger + limit submit","handlingStrategy":"validation","validationCode":"const SUPPORTED: &[OrderType] = &[OrderType::Limit, OrderType::Market];\nanyhow::ensure!(SUPPORTED.contains(&order_type), \"order type {order_type} unsupported on Lighter\");","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Submit only LIMIT or MARKET orders to Lighter","Implement stop/trailing logic client-side","Review LighterOrderType::try_from(OrderType) for the supported set"],"tags":["order-type","unsupported","execution"],"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-14T00:17:10.932Z"}