{"record":{"id":"41089c81ce5e4c8a","repo":"nautechsystems/nautilus_trader","slug":"position-side-short-conflicts-with-positive-positi","errorCode":null,"errorMessage":"position_side SHORT conflicts with positive position_amt","messagePattern":"position_side SHORT conflicts with positive position_amt","errorType":"validation","errorClass":"anyhow::Error","httpStatus":null,"severity":"error","filePath":"crates/adapters/binance/src/futures/execution.rs","lineNumber":1029,"sourceCode":"\n        let entry_price: Decimal = position\n            .entry_price\n            .parse()\n            .context(\"invalid entry_price\")?;\n\n        let position_side = if position_amount > Decimal::ZERO {\n            PositionSide::Long\n        } else {\n            PositionSide::Short\n        };\n\n        if self.config.use_position_ids {\n            match position.position_side {\n                Some(BinancePositionSide::Long) => anyhow::ensure!(\n                    position_side == PositionSide::Long,\n                    \"position_side LONG conflicts with negative position_amt\"\n                ),\n                Some(BinancePositionSide::Short) => anyhow::ensure!(\n                    position_side == PositionSide::Short,\n                    \"position_side SHORT conflicts with positive position_amt\"\n                ),\n                _ => {}\n            }\n        }\n\n        let venue_position_id = make_venue_position_id(\n            self.config.use_position_ids,\n            instrument_id,\n            position.position_side,\n        )?;\n\n        if let Some(venue_position_id) = venue_position_id {\n            self.ensure_cached_position_id_compatible(\n                instrument_id,\n                position_side,\n                venue_position_id,","sourceCodeStart":1011,"sourceCodeEnd":1047,"githubUrl":"https://github.com/nautechsystems/nautilus_trader/blob/18893faf8b356be3320add8de2f861b0b647cf06/crates/adapters/binance/src/futures/execution.rs#L1011-L1047","documentation":"Mirror case of error 1840: when use_position_ids=true and Binance reports positionSide=SHORT, the sign of position_amt must be negative (short positions on Binance carry a negative amount). A positive amount alongside a SHORT side marker is contradictory, so create_position_report rejects the position risk record instead of emitting an inconsistent report.","triggerScenarios":"create_position_report called from generate_position_status_reports with position.position_side == Some(BinancePositionSide::Short) while position_amt parses to a positive value; usually from stale or partially updated position risk data, or from one-way-mode records mislabeled as SHORT.","commonSituations":"Account switched out of hedge mode leaving stale side metadata; manual trades in the Binance web UI while the adapter reconciles; dual-side position records where the closing leg has not yet been applied server-side.","solutions":["Confirm the account is in hedge mode consistently with adapter config (use_position_ids=true assumes hedge-mode style positionSide fields).","Set use_position_ids=false in the exec client config to bypass side/ID consistency checks.","Force a fresh reconciliation of position risk data to replace the stale snapshot.","Close and flatten the affected position via the venue, then let the adapter rebuild state from an empty book."],"exampleFix":"// keep hedge mode and venue IDs aligned\n// before\nBinanceFuturesExecClientConfig { use_position_ids: true } // account in one-way mode\n// after\n// switch Binance account to Hedge Mode, or:\nBinanceFuturesExecClientConfig { use_position_ids: false }","handlingStrategy":"validation","validationCode":"if cfg.use_position_ids {\n    let amt: Decimal = position.position_amt.parse()?;\n    if position.position_side == Some(BinancePositionSide::Short) && amt > Decimal::ZERO {\n        log::warn!(\"inconsistent SHORT side with positive amt for {}\", position.symbol);\n    }\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Verify hedge mode before enabling use_position_ids","Force full re-reconciliation after changing position mode","Flatten positions before switching account position mode"],"tags":["reconciliation","position-side","binance-futures","hedge-mode"],"backgroundTag":"invalid-state-transition","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"}