{"record":{"id":"d9564d7fe6c935cf","repo":"nautechsystems/nautilus_trader","slug":"failed-to-parse-venue-order-id-e","errorCode":null,"errorMessage":"failed to parse venue_order_id: {e}","messagePattern":"failed to parse venue_order_id: (.+?)","errorType":"exception","errorClass":"anyhow::Error","httpStatus":null,"severity":"error","filePath":"crates/adapters/binance/src/futures/execution.rs","lineNumber":2314,"sourceCode":"    }\n\n    fn query_order(&self, cmd: QueryOrder) -> anyhow::Result<()> {\n        log::debug!(\"query_order: client_order_id={}\", cmd.client_order_id);\n\n        let algo_lookup = self.resolve_algo_lookup(Some(cmd.client_order_id), cmd.params.as_ref());\n        let http_client = self.http_client.clone();\n        let command = cmd;\n        let emitter = self.emitter.clone();\n        let account_id = self.core.account_id;\n        let clock = self.clock;\n\n        let symbol = format_binance_symbol(&command.instrument_id);\n        let order_id = command\n            .venue_order_id\n            .map(|id| {\n                id.inner()\n                    .parse::<i64>()\n                    .map_err(|e| anyhow::anyhow!(\"failed to parse venue_order_id: {e}\"))\n            })\n            .transpose()?;\n        let orig_client_order_id = Some(encode_broker_id(\n            &command.client_order_id,\n            BINANCE_NAUTILUS_FUTURES_BROKER_ID,\n        ));\n        let (price_precision, size_precision) =\n            self.get_instrument_precision(command.instrument_id);\n        let treat_expired_as_canceled = self.config.treat_expired_as_canceled;\n\n        self.spawn_task(\"query_order\", async move {\n            if algo_lookup == BinanceFuturesAlgoLookup::AlgoId {\n                match http_client\n                    .query_algo_order_with_history(\n                        command.instrument_id,\n                        Some(command.client_order_id),\n                        command.venue_order_id,\n                    )","sourceCodeStart":2296,"sourceCodeEnd":2332,"githubUrl":"https://github.com/nautechsystems/nautilus_trader/blob/a4b06ed870971b5671d12754ea138a3ab99b1dec/crates/adapters/binance/src/futures/execution.rs#L2296-L2332","documentation":"The adapter converts the QueryOrder command's VenueOrderId into the integer orderId required by the Binance Futures REST API (GET /fapi/v1/order or /dapi/v1/order). Binance futures order IDs are numeric strings; when the provided venue_order_id does not parse as i64 (letters, dashes, IDs from another venue, corrupted cache values), submission fails locally with this message before any HTTP request is made.","triggerScenarios":"Sending QueryOrder to the Binance Futures execution client with a venue_order_id whose inner string is not a valid i64 — e.g. an ID minted by a different venue adapter, a hand-crafted placeholder in tests, or a stale cache entry.","commonSituations":"Multi-venue strategies routing queries to the wrong execution client; test suites using placeholder IDs; replaying recorded IDs with formatting applied; mixed spot/futures setups where ID formats differ.","solutions":["Omit venue_order_id on the query so the adapter resolves the order via origClientOrderId (client_order_id)","Verify the ID originated from a Binance Futures order acknowledgment or fill (numeric string)","Check strategy routing so the query reaches the execution client that owns the order","If the cache may be stale, run reconciliation first so venue order IDs are repopulated"],"exampleFix":"// before — venue_order_id from a non-Binance system\nlet venue_order_id = Some(VenueOrderId::new(\"oid-abc-123\"));\n\n// after — omit it; the adapter queries by origClientOrderId\nlet venue_order_id = None; // client_order_id must be set on the command","handlingStrategy":"validation","validationCode":"// Before sending QueryOrder to the Binance Futures client\nif let Some(vid) = cmd.venue_order_id.as_ref() {\n    if vid.inner().parse::<i64>().is_err() {\n        // Non-numeric ID: clear it so the adapter queries by origClientOrderId\n        cmd.venue_order_id = None;\n    }\n}","typeGuard":"fn is_binance_numeric_venue_id(id: &VenueOrderId) -> bool {\n    id.inner().parse::<i64>().is_ok()\n}","tryCatchPattern":"On an error containing 'failed to parse venue_order_id', re-issue the query with venue_order_id cleared so the adapter resolves the order by client_order_id.","preventionTips":["Only pass venue_order_id values obtained from Binance Futures order events (numeric strings)","Prefer client_order_id lookups in cross-venue strategy code","Validate IDs in test fixtures before replaying them against live clients"],"tags":["binance","futures","venue-order-id","query-order","rust"],"backgroundTag":"invalid-venue-order-id","analyzedSha":"a4b06ed870971b5671d12754ea138a3ab99b1dec","analyzedAt":"2026-08-16T22:54:50.089Z","schemaVersion":2},"datasetVersion":"2026-08-16T23:17:17.608Z"}