{"record":{"id":"e54d71718bd0813a","repo":"nautechsystems/nautilus_trader","slug":"unsupported-ordertype-for-conditional-orders-val","errorCode":null,"errorMessage":"Unsupported OrderType for conditional orders: {value:?}","messagePattern":"Unsupported OrderType for conditional orders: (.+?)","errorType":"panic","errorClass":null,"httpStatus":null,"severity":"error","filePath":"crates/adapters/hyperliquid/src/common/enums.rs","lineNumber":312,"sourceCode":"            HyperliquidConditionalOrderType::StopLimit => Self::StopLimit,\n            HyperliquidConditionalOrderType::TakeProfitMarket => Self::MarketIfTouched,\n            HyperliquidConditionalOrderType::TakeProfitLimit => Self::LimitIfTouched,\n            HyperliquidConditionalOrderType::TrailingStopMarket => Self::TrailingStopMarket,\n            HyperliquidConditionalOrderType::TrailingStopLimit => Self::TrailingStopLimit,\n        }\n    }\n}\n\nimpl From<OrderType> for HyperliquidConditionalOrderType {\n    fn from(value: OrderType) -> Self {\n        match value {\n            OrderType::StopMarket => Self::StopMarket,\n            OrderType::StopLimit => Self::StopLimit,\n            OrderType::MarketIfTouched => Self::TakeProfitMarket,\n            OrderType::LimitIfTouched => Self::TakeProfitLimit,\n            OrderType::TrailingStopMarket => Self::TrailingStopMarket,\n            OrderType::TrailingStopLimit => Self::TrailingStopLimit,\n            _ => panic!(\"Unsupported OrderType for conditional orders: {value:?}\"),\n        }\n    }\n}\n\n/// Represents trailing offset types for trailing stop orders.\n///\n/// Trailing stops adjust dynamically based on market movement:\n/// - Price: Fixed price offset (e.g., $100)\n/// - Percentage: Percentage offset (e.g., 5%)\n/// - BasisPoints: Basis points offset (e.g., 250 bps = 2.5%)\n#[derive(\n    Copy,\n    Clone,\n    Debug,\n    Display,\n    PartialEq,\n    Eq,\n    Hash,","sourceCodeStart":294,"sourceCodeEnd":330,"githubUrl":"https://github.com/nautechsystems/nautilus_trader/blob/18893faf8b356be3320add8de2f861b0b647cf06/crates/adapters/hyperliquid/src/common/enums.rs#L294-L330","documentation":"This From<OrderType> conversion maps nautilus OrderType values to Hyperliquid conditional (trigger) order types. Variants without a Hyperliquid conditional equivalent (e.g. Market, Limit, or other non-trigger types) fall into a catch-all that panics. It means you passed an order type that cannot be expressed as a Hyperliquid conditional order.","triggerScenarios":"Converting an OrderType such as OrderType::Market or OrderType::Limit into the Hyperliquid conditional enum (e.g. while submitting a trigger/conditional order request) with a variant not listed in the match arms.","commonSituations":"Strategy code submits conditional orders but builds the order type dynamically from a config or signal; a new OrderType variant was added to the core enum but not mapped in the Hyperliquid adapter; order routing sends non-conditional orders down the conditional-order path.","solutions":["Only pass conditional-capable OrderTypes (StopMarket, StopLimit, MarketIfTouched, LimitIfTouched, TrailingStop*) through this conversion","Route Market/Limit orders through the standard (non-conditional) Hyperliquid order submission path","Extend the match with a mapping if Hyperliquid added support for the missing type","Pre-validate the OrderType before calling the conversion and reject unsupported values cleanly"],"exampleFix":"// before\nlet hl_type = OKXHyperliquidConditionalType::from(OrderType::Market);\n// after\nassert!(matches!(order_type, OrderType::StopMarket | OrderType::StopLimit | ...));\nlet hl_type = ConditionalType::from(order_type);","handlingStrategy":"validation","validationCode":"const CONDITIONAL: &[OrderType] = &[\n    OrderType::StopMarket, OrderType::StopLimit,\n    OrderType::MarketIfTouched, OrderType::LimitIfTouched,\n    OrderType::TrailingStopMarket, OrderType::TrailingStopLimit,\n];\nfn is_conditional(t: &OrderType) -> bool { CONDITIONAL.contains(t) }","typeGuard":"fn supports_conditional(t: &OrderType) -> bool {\n    !matches!(t, OrderType::Market | OrderType::Limit)\n}","tryCatchPattern":null,"preventionTips":["Branch on order type before choosing the conditional vs plain submission path","Regenerate/update adapter mappings whenever the core OrderType enum changes","Unit-test From<OrderType> conversions for every variant","Fail with a logged, recoverable error instead of routing non-conditional types into conditional conversion"],"tags":["rust","panic","hyperliquid","order-type","enum-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-14T00:17:10.932Z"}