nautechsystems/nautilus_trader · error

Invalid venue order ID

Error message

Invalid venue order ID

What it means

modify_order parses venue_order_id into an i64 for the orderId parameter; a non-numeric ID (letters, foreign-venue IDs, corrupted values) fails the parse and aborts the modify. Unlike cancel_order, which falls back to the client ID when the venue ID will not parse, the modify path errors out here even when a client_order_id is available.

Source

Thrown at crates/adapters/binance/src/futures/http/client.rs:2310

        order_side: OrderSide,
        quantity: Quantity,
        price: Price,
    ) -> anyhow::Result<OrderStatusReport> {
        anyhow::ensure!(
            venue_order_id.is_some() || client_order_id.is_some(),
            "Either venue_order_id or client_order_id must be provided"
        );

        let symbol = format_binance_symbol(&instrument_id);
        let size_precision = self.get_size_precision(&symbol)?;
        let price_precision = self.get_price_precision(&symbol)?;

        let binance_side = BinanceSide::try_from(order_side)?;

        let order_id = venue_order_id
            .map(|id| id.inner().parse::<i64>())
            .transpose()
            .map_err(|_| anyhow::anyhow!("Invalid venue order ID"))?;

        let params = BinanceModifyOrderParams {
            symbol,
            order_id,
            orig_client_order_id: client_order_id
                .map(|id| encode_broker_id(&id, BINANCE_NAUTILUS_FUTURES_BROKER_ID)),
            side: binance_side,
            quantity: quantity.to_string(),
            price: price.to_string(),
            recv_window: None,
        };

        let order = self.inner.modify_order(&params).await?;
        let ts_init = self.clock.get_time_ns();
        order.to_order_status_report(
            account_id,
            instrument_id,
            price_precision,

View on GitHub (pinned to a4b06ed870)

Solutions

  1. Re-derive the correct numeric venue order ID: query order status by client_order_id first
  2. Let reconciliation populate venue_order_id before issuing modifies
  3. Verify IDs originate from Binance Futures order events (they are numeric strings)
Defensive patterns

Strategy: validation

Validate before calling

// Before submitting a modify over REST
if let Some(vid) = venue_order_id.as_ref() {
    if vid.inner().parse::<i64>().is_err() {
        // Resolve the numeric venue ID by querying order status first,
        // then retry the modify with the corrected ID
    }
}

Type guard

fn venue_id_is_numeric(id: &VenueOrderId) -> bool {
    id.inner().parse::<i64>().is_ok()
}

Try / catch

On an error containing 'Invalid venue order ID', query the order by client_order_id to obtain the numeric venue ID, then resubmit the modify.

Prevention

When it happens

Trigger: ModifyOrder with a venue_order_id whose inner string is not a valid i64, submitted over the REST path (ws trading inactive).

Common situations: Cross-venue ID mix-ups; placeholder IDs in tests; cache corruption or manually edited identifiers.

Related errors


AI-assisted analysis of nautechsystems/nautilus_trader@a4b06ed870 (2026-08-16). Data as JSON: /api/errors/a6bed9b46708328f. Report an issue: GitHub.