{"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":null,"httpStatus":null,"severity":"error","filePath":"crates/adapters/binance/src/futures/execution.rs","lineNumber":2876,"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        let use_position_ids = self.config.use_position_ids;\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,","sourceCodeStart":2858,"sourceCodeEnd":2894,"githubUrl":"https://github.com/nautechsystems/nautilus_trader/blob/18893faf8b356be3320add8de2f861b0b647cf06/crates/adapters/binance/src/futures/execution.rs#L2858-L2894","documentation":"query_order optionally converts the command's venue_order_id (a VenueOrderId wrapping a string) into the i64 Binance orderId. If the inner string is not a valid i64, the parse error is surfaced with this message.","triggerScenarios":"Calling query_order with an order status command whose venue_order_id.inner() is not a plain numeric string — e.g. a UUID-style ID, an empty string, or an ID assigned by a different venue.","commonSituations":"Routing an order-query command to the Binance Futures execution client for an order that was actually placed on another venue; corrupted venue_order_id in persisted state; or a client_order_id accidentally stored as the venue_order_id.","solutions":["Verify the order originated on Binance Futures and that venue_order_id holds Binance's numeric orderId.","Query by client_order_id instead (the adapter builds orig_client_order_id automatically).","Fix state/store corruption so venue_order_id contains the numeric exchange ID string.","Add a pre-check that venue_order_id.inner().parse::<i64>().is_ok() before issuing the command."],"exampleFix":"// before\nif !command.venue_order_id.map(|id| id.inner().parse::<i64>().is_ok()).unwrap_or(true) {\n    return Err(...);\n}\n// after (caller-side guard)\nlet id_ok = command.venue_order_id\n    .map(|id| id.inner().parse::<i64>().is_ok())\n    .unwrap_or(true);\nanyhow::ensure!(id_ok, \"venue_order_id must be a numeric Binance orderId\");","handlingStrategy":"type-guard","validationCode":"fn is_numeric_venue_order_id(cmd: &QueryOrder) -> bool {\n    cmd.venue_order_id.map(|id| id.inner().parse::<i64>().is_ok()).unwrap_or(true)\n}","typeGuard":"fn valid_binance_order_id(id: &VenueOrderId) -> Option<i64> {\n    id.inner().parse::<i64>().ok()\n}","tryCatchPattern":"match client.query_order(cmd).await {\n    Err(e) if e.to_string().starts_with(\"failed to parse venue_order_id\") => {\n        warn!(\"non-Binance or corrupted venue_order_id: {e}\");\n    }\n    other => other?,\n}","preventionTips":["Only route order-query commands to the venue that filled the order.","Validate venue_order_id is numeric before persistence.","Prefer client_order_id queries for adapter-placed orders."],"tags":["binance","parsing","order-query","identifier"],"backgroundTag":"invalid-identifier-format","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"}