{"record":{"id":"130ec311a4726286","repo":"nautechsystems/nautilus_trader","slug":"unsupported-orderside-for-binance-value","errorCode":null,"errorMessage":"Unsupported `OrderSide` for Binance: {value:?}","messagePattern":"Unsupported `OrderSide` for Binance: (.+?)","errorType":"exception","errorClass":"anyhow::Error","httpStatus":null,"severity":"error","filePath":"crates/adapters/binance/src/common/enums.rs","lineNumber":174,"sourceCode":"\n/// Order side for Binance orders and trades.\n#[derive(Copy, Clone, Debug, PartialEq, Eq, Hash, Serialize, Deserialize)]\n#[serde(rename_all = \"UPPERCASE\")]\npub enum BinanceSide {\n    /// Buy side.\n    Buy,\n    /// Sell side.\n    Sell,\n}\n\nimpl TryFrom<OrderSide> for BinanceSide {\n    type Error = anyhow::Error;\n\n    fn try_from(value: OrderSide) -> Result<Self, Self::Error> {\n        match value {\n            OrderSide::Buy => Ok(Self::Buy),\n            OrderSide::Sell => Ok(Self::Sell),\n            _ => anyhow::bail!(\"Unsupported `OrderSide` for Binance: {value:?}\"),\n        }\n    }\n}\n\nimpl From<BinanceSide> for OrderSide {\n    fn from(value: BinanceSide) -> Self {\n        match value {\n            BinanceSide::Buy => Self::Buy,\n            BinanceSide::Sell => Self::Sell,\n        }\n    }\n}\n\n/// Position side for dual-side position mode.\n#[derive(Copy, Clone, Debug, PartialEq, Eq, Hash, Serialize, Deserialize)]\n#[serde(rename_all = \"UPPERCASE\")]\n#[cfg_attr(\n    feature = \"python\",","sourceCodeStart":156,"sourceCodeEnd":192,"githubUrl":"https://github.com/nautechsystems/nautilus_trader/blob/a4b06ed870971b5671d12754ea138a3ab99b1dec/crates/adapters/binance/src/common/enums.rs#L156-L192","documentation":"Converting a NautilusTrader OrderSide to a BinanceSide supports only Buy and Sell - Binance has no representation for any other side. The TryFrom conversion fails, typically while encoding a submit/amend request in the execution client.","triggerScenarios":"Creating a Binance order whose OrderSide is any variant other than Buy or Sell (e.g. a default-constructed, undetermined, or non-directional side reaching the encoder), or porting a strategy/config from an adapter that accepts more sides.","commonSituations":"Uninitialized/default side leaking from a hand-built order request; parsing sides from external signals that yield an unexpected value; cross-venue strategy code reused against Binance.","solutions":["Set the order side explicitly to OrderSide::Buy or OrderSide::Sell before submitting to a Binance execution client","Validate/normalize externally sourced sides to Buy/Sell at your trust boundary before building the order","Check for a default-constructed OrderRequest whose side was never assigned"],"exampleFix":"// before\nlet side = OrderSide::default(); // non-directional -> conversion fails\n\n// after\nlet side = OrderSide::Buy; // or OrderSide::Sell","handlingStrategy":"type-guard","validationCode":"fn is_binance_supported_side(side: OrderSide) -> bool {\n    matches!(side, OrderSide::Buy | OrderSide::Sell)\n}","typeGuard":"fn is_binance_supported_side(side: OrderSide) -> bool {\n    matches!(side, OrderSide::Buy | OrderSide::Sell)\n}","tryCatchPattern":"match BinanceSide::try_from(order.side()) {\n    Ok(side) => submit(order, side),\n    Err(_) => log::error!(\"order {} has side {:?} unsupported by Binance - rejected locally\", order.id(), order.side()),\n}","preventionTips":["Default order builders to an explicit Buy/Sell - never leave side unset","Assert supported sides in strategy tests before connecting a Binance venue","Normalize third-party signal sides to Buy/Sell at ingestion"],"tags":["binance","order-side","enum-conversion","validation","order-submission"],"backgroundTag":"unsupported-enum-value","analyzedSha":"a4b06ed870971b5671d12754ea138a3ab99b1dec","analyzedAt":"2026-08-16T22:54:50.089Z","schemaVersion":2},"datasetVersion":"2026-08-16T23:17:17.608Z"}