{"record":{"id":"8577cea757b04d19","repo":"nautechsystems/nautilus_trader","slug":"actual-order-id-mismatch-expected-expected-actua","errorCode":null,"errorMessage":"actual order ID mismatch: expected {expected_actual_order_id}, was {}","messagePattern":"actual order ID mismatch: expected (.+?), was (.+?)","errorType":"exception","errorClass":"anyhow::Error","httpStatus":null,"severity":"error","filePath":"crates/adapters/binance/src/futures/http/models.rs","lineNumber":1620,"sourceCode":"    #[expect(clippy::too_many_arguments)]\n    pub fn to_order_status_report_with_actual(\n        &self,\n        actual: &BinanceFuturesOrder,\n        account_id: AccountId,\n        instrument_id: InstrumentId,\n        price_precision: u8,\n        size_precision: u8,\n        treat_expired_as_canceled: bool,\n        ts_init: UnixNanos,\n    ) -> anyhow::Result<OrderStatusReport> {\n        let expected_actual_order_id = self\n            .actual_order_id\n            .as_deref()\n            .filter(|id| !id.is_empty())\n            .context(\"algo order has no actual_order_id\")?;\n\n        if expected_actual_order_id != actual.order_id.to_string() {\n            anyhow::bail!(\n                \"actual order ID mismatch: expected {expected_actual_order_id}, was {}\",\n                actual.order_id\n            );\n        }\n\n        if self.symbol != actual.symbol {\n            anyhow::bail!(\n                \"actual order symbol mismatch: expected {}, was {}\",\n                self.symbol,\n                actual.symbol\n            );\n        }\n\n        if self.side != actual.side {\n            anyhow::bail!(\n                \"actual order side mismatch: expected {:?}, was {:?}\",\n                self.side,\n                actual.side","sourceCodeStart":1602,"sourceCodeEnd":1638,"githubUrl":"https://github.com/nautechsystems/nautilus_trader/blob/18893faf8b356be3320add8de2f861b0b647cf06/crates/adapters/binance/src/futures/http/models.rs#L1602-L1638","documentation":"When reconciling an algo (conditional) order report with the algorithm's actual sub-order, the adapter verifies the reported actual_order_id matches the actual order's order_id string. A mismatch means the paired execution report does not correspond to the expected algo child order, indicating corrupted or mismatched exchange data.","triggerScenarios":"Parsing a Binance Futures algo order update where the record's actual_order_id field (non-empty) differs from actual.order_id.to_string(); the executor matched the wrong child order or the exchange payload contains stale/crossed identifiers.","commonSituations":"Exchange-side data glitches in algo (conditional) order streams; replayed or reordered websocket messages pairing an old actual order with a new algo record; manually constructed test fixtures with inconsistent IDs.","solutions":["Log both IDs and re-fetch the algo order state via REST to reconcile with fresh data.","Check for replayed/duplicate websocket messages and ensure sequence handling.","If in a fixture, correct actual_order_id or actual.order_id so they match."],"exampleFix":"// before\nactual_order_id: Some(\"123\"), actual: AlgoSubOrder { order_id: 456, .. }\n// after\nactual_order_id: Some(\"456\"), actual: AlgoSubOrder { order_id: 456, .. }","handlingStrategy":"try-catch","validationCode":null,"typeGuard":null,"tryCatchPattern":"match result {\n    Err(e) if e.to_string().contains(\"actual order ID mismatch\") => {\n        tracing::warn!(\"algo reconciliation mismatch, refetching via REST\");\n        // re-fetch algo order state before continuing\n    }\n    r => r?,\n}","preventionTips":["Handle websocket replays/deduplication so old actual orders are not re-paired.","Reconcile with REST snapshots after stream anomalies.","Keep test fixtures internally consistent between algo record and sub-order IDs."],"tags":["reconciliation","order-id","binance-futures","algo-orders"],"backgroundTag":"internal-invariant-violation","analyzedSha":"18893faf8b356be3320add8de2f861b0b647cf06","analyzedAt":"2026-09-08T20:49:34.690Z","contentChangedAt":"2026-09-08T20:49:34.690Z","schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}