nautechsystems/nautilus_trader · error

Either venue_order_id or client_order_id must be provided

Error message

Either venue_order_id or client_order_id must be provided

What it means

The REST modify endpoint must identify the target order by orderId or origClientOrderId. modify_order rejects calls that provide neither identifier before building the request, so the venue is never asked to modify an unspecified order.

Source

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

    ///
    /// # Errors
    ///
    /// Returns an error if:
    /// - Neither venue_order_id nor client_order_id is provided.
    /// - The instrument is not cached.
    /// - The request fails.
    #[expect(clippy::too_many_arguments)]
    pub async fn modify_order(
        &self,
        account_id: AccountId,
        instrument_id: InstrumentId,
        venue_order_id: Option<VenueOrderId>,
        client_order_id: Option<ClientOrderId>,
        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,

View on GitHub (pinned to a4b06ed870)

Solutions

  1. Wait for OrderSubmitted / OrderAccepted so venue_order_id is assigned before modifying
  2. Ensure the ModifyOrder command carries at least client_order_id
  3. Check command routing/serialization if optional fields are being stripped in transit
Defensive patterns

Strategy: validation

Validate before calling

// Before submitting a modify
let has_identifier = cmd.venue_order_id.is_some() || cmd.client_order_id.is_some();
assert!(has_identifier, "modify needs venue_order_id or client_order_id");

Type guard

fn modify_identifiable(venue_order_id: Option<&VenueOrderId>, client_order_id: Option<&ClientOrderId>) -> bool {
    venue_order_id.is_some() || client_order_id.is_some()
}

Try / catch

On this local rejection, wait for the order's acknowledgment event so venue_order_id is assigned (or propagate client_order_id), then resubmit the modify.

Prevention

When it happens

Trigger: ModifyOrder with both venue_order_id and client_order_id absent — typically a modify issued before the order was acknowledged (no venue ID assigned yet) with the client ID also not propagated.

Common situations: Modifying immediately after submission; custom routing or serialization layers dropping optional fields; replayed commands with missing fields.

Related errors


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