{"record":{"id":"9797037059cedff3","repo":"nautechsystems/nautilus_trader","slug":"unsupported-order-type-order-type-979703","errorCode":null,"errorMessage":"Unsupported order type: {order_type:?}","messagePattern":"Unsupported order type: (.+?)","errorType":"validation","errorClass":"anyhow::Error","httpStatus":null,"severity":"error","filePath":"crates/adapters/hyperliquid/src/common/converters.rs","lineNumber":199,"sourceCode":"                is_market: true,\n                trigger_px,\n                tpsl: HyperliquidTpSl::Sl,\n            }\n        }\n\n        // Trailing stop limit (requires special handling)\n        OrderType::TrailingStopLimit => {\n            let trigger_px = trigger_price\n                .context(\"Trigger price required for TrailingStopLimit order\")?\n                .to_string();\n            HyperliquidOrderType::Trigger {\n                is_market: false,\n                trigger_px,\n                tpsl: HyperliquidTpSl::Sl,\n            }\n        }\n\n        _ => anyhow::bail!(\"Unsupported order type: {order_type:?}\"),\n    };\n\n    Ok(result)\n}\n\n/// Converts a Hyperliquid order type to a Nautilus `OrderType`.\npub fn hyperliquid_order_type_to_nautilus(hl_order_type: &HyperliquidOrderType) -> OrderType {\n    match hl_order_type {\n        HyperliquidOrderType::Limit { .. } => OrderType::Limit,\n        HyperliquidOrderType::Trigger {\n            is_market, tpsl, ..\n        } => match (is_market, tpsl) {\n            (true, HyperliquidTpSl::Sl) => OrderType::StopMarket,\n            (false, HyperliquidTpSl::Sl) => OrderType::StopLimit,\n            (true, HyperliquidTpSl::Tp) => OrderType::MarketIfTouched,\n            (false, HyperliquidTpSl::Tp) => OrderType::LimitIfTouched,\n        },\n    }","sourceCodeStart":181,"sourceCodeEnd":217,"githubUrl":"https://github.com/nautechsystems/nautilus_trader/blob/18893faf8b356be3320add8de2f861b0b647cf06/crates/adapters/hyperliquid/src/common/converters.rs#L181-L217","documentation":"nautilus_order_type_to_hyperliquid maps Nautilus OrderType values to Hyperliquid order kinds. Only Limit, Market, and the trigger-based stop/take-profit variants are translated; any other OrderType hits the catch-all arm and bails.","triggerScenarios":"Passing an OrderType not handled by the match (e.g. MarketToLimit, TrailingStopMarket, TrailingStopLimit) into nautilus_order_type_to_hyperliquid when converting an order for the Hyperliquid adapter.","commonSituations":"Generic strategy code that builds orders without filtering by venue capabilities; new Nautilus order types added after the adapter was written; routing an order to Hyperliquid that was designed for another exchange.","solutions":["Use only OrderType::Limit, Market, StopMarket, StopLimit, LimitIfTouched, or MarketIfTouched for Hyperliquid.","Check the order type before routing and reject/redirect unsupported types at the strategy layer.","If a genuinely new Nautilus variant must be supported, add an arm to the converter mapping it to a Hyperliquid order kind."],"exampleFix":"// before\nlet hl = nautilus_order_type_to_hyperliquid(&OrderType::TrailingStopMarket)?;\n// after\nif matches!(order_type, OrderType::TrailingStopMarket | OrderType::MarketToLimit) {\n    anyhow::bail!(\"route this order to a venue that supports it\");\n}\nlet hl = nautilus_order_type_to_hyperliquid(&order_type)?;","handlingStrategy":"validation","validationCode":"const SUPPORTED: &[OrderType] = &[\n    OrderType::Limit, OrderType::Market, OrderType::StopMarket, OrderType::StopLimit,\n    OrderType::LimitIfTouched, OrderType::MarketIfTouched,\n];\nfn hyperliquid_supports(t: &OrderType) -> bool { SUPPORTED.contains(t) }","typeGuard":null,"tryCatchPattern":"match nautilus_order_type_to_hyperliquid(&order_type) {\n    Ok(hl) => send(hl),\n    Err(e) => anyhow::bail!(\"venue routing failed: {e}\"), // redirect or drop order\n}","preventionTips":["Keep a per-venue capability table checked at order construction.","Never route venue-agnostic strategies without an order-type filter.","Track Nautilus OrderType additions and re-verify adapter coverage."],"tags":["hyperliquid","order-types","rust","conversion"],"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"}