{"record":{"id":"191b323b9923ce43","repo":"nautechsystems/nautilus_trader","slug":"unspecified-bybit-order-side","errorCode":null,"errorMessage":"Unspecified Bybit order side","messagePattern":"Unspecified Bybit order side","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"crates/adapters/bybit/src/common/enums.rs","lineNumber":653,"sourceCode":"\nimpl From<BybitOrderSide> for Option<OrderSide> {\n    fn from(value: BybitOrderSide) -> Self {\n        match value {\n            BybitOrderSide::Buy => Some(OrderSide::Buy),\n            BybitOrderSide::Sell => Some(OrderSide::Sell),\n            BybitOrderSide::Unknown => None,\n        }\n    }\n}\n\nimpl TryFrom<BybitOrderSide> for OrderSide {\n    type Error = anyhow::Error;\n\n    fn try_from(value: BybitOrderSide) -> Result<Self, Self::Error> {\n        match value {\n            BybitOrderSide::Buy => Ok(Self::Buy),\n            BybitOrderSide::Sell => Ok(Self::Sell),\n            BybitOrderSide::Unknown => anyhow::bail!(\"Unspecified Bybit order side\"),\n        }\n    }\n}\n\nimpl From<OrderSide> for BybitOrderSide {\n    fn from(value: OrderSide) -> Self {\n        match value {\n            OrderSide::Buy => Self::Buy,\n            OrderSide::Sell => Self::Sell,\n        }\n    }\n}\n\nimpl From<BybitTriggerType> for TriggerType {\n    fn from(value: BybitTriggerType) -> Self {\n        match value {\n            BybitTriggerType::None => Self::Default,\n            BybitTriggerType::LastPrice => Self::LastPrice,","sourceCodeStart":635,"sourceCodeEnd":671,"githubUrl":"https://github.com/nautechsystems/nautilus_trader/blob/18893faf8b356be3320add8de2f861b0b647cf06/crates/adapters/bybit/src/common/enums.rs#L635-L671","documentation":"The `TryFrom<BybitOrderSide>` impl for the domain `OrderSide` rejects `BybitOrderSide::Unknown` with this error, because a side that Bybit did not map to Buy/Sell cannot be converted into a domain order side. It prevents silently treating an unspecified/unknown exchange side as a real direction.","triggerScenarios":"Converting a Bybit order/notification side to the domain type when the raw payload contained an unrecognized or missing side, yielding `BybitOrderSide::Unknown`.","commonSituations":"Parsing execution/order updates from Bybit whose `orderSide` field is empty or a newly introduced value; older adapter version not knowing a new side string; conditional-order payloads with absent side.","solutions":["Inspect the raw Bybit payload's side field and fix the mapping for the new/empty value.","Update the adapter to a version that recognizes the side string Bybit is sending (API version change).","Guard the conversion: only convert when `side != BybitOrderSide::Unknown`, otherwise log and skip.","Check for market-specific quirks (e.g. some instruments report side differently) and normalize upstream."],"exampleFix":"// before\nlet side: OrderSide = bybit_side.try_into()?;\n// after\nlet side = match bybit_side {\n    BybitOrderSide::Unknown => { log::warn!(\"skipping order with unspecified side\"); return Ok(()); }\n    s => s.try_into()?,\n};","handlingStrategy":"validation","validationCode":"fn order_side_is_known(side: &BybitOrderSide) -> bool {\n    !matches!(side, BybitOrderSide::Unknown)\n}\nanyhow::ensure!(order_side_is_known(&bybit_side), \"Bybit side missing in payload\");","typeGuard":"fn as_known_side(side: &BybitOrderSide) -> Option<&BybitOrderSide> {\n    match side {\n        BybitOrderSide::Unknown => None,\n        s => Some(s),\n    }\n}","tryCatchPattern":"match OrderSide::try_from(bybit_side) {\n    Ok(side) => process(side),\n    Err(e) if e.to_string().contains(\"Unspecified Bybit order side\") => {\n        warn!(\"order update without side; skipping\");\n    }\n    Err(e) => return Err(e),\n}","preventionTips":["Validate the raw `orderSide` field before constructing domain objects","Update the adapter when Bybit introduces new side values","Log the raw payload when conversion fails to spot API changes early","Skip/queue rather than fail on malformed exchange notifications"],"tags":["bybit","enum-conversion","order-side"],"backgroundTag":"invalid-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"}