nautechsystems/nautilus_trader · error · BinanceSpotHttpError::ValidationError

venue_order_id required for modify

Error message

venue_order_id required for modify

What it means

A `ModifyOrder` command arrived without a `venue_order_id`, which Binance Spot requires to identify the order being amended (Spot modify uses the venue order ID). The client raises a `BinanceSpotHttpError::ValidationError` with this message.

Solutions

  1. Resolve the venue_order_id (e.g. from the execution reports/cache) before calling modify_order.
  2. Only modify orders after their submitted→accepted transition so a venue_order_id exists.
  3. Fall back to cancel + replace when the venue order ID is unknown.
  4. Check the order cache lookup that populates the command's venue_order_id.

Example fix

// before
let venue_order_id = None; // modify fails
// after
let venue_order_id = cache.venue_order_id(&client_order_id)
    .ok_or_else(|| anyhow::anyhow!("cannot modify: no venue_order_id yet"))?;
Defensive patterns

Strategy: type-guard

Validate before calling

if cmd.venue_order_id.is_none() { return Err(anyhow!("modify requires a venue_order_id; use cancel-replace instead")); }

Type guard

fn can_modify(cmd: &ModifyOrder) -> bool {
    cmd.venue_order_id.is_some()
}

Try / catch

match client.modify_order(cmd).await {
    Err(e) if e.to_string().contains("venue_order_id required") => {
        // fall back to cancel + new order
    }
    other => other?,
}

Prevention

When it happens

Trigger: Calling `modify_order` with a command that only carries a client_order_id (or neither) and no venue_order_id, when the modify path requires the venue-assigned ID.

Common situations: Submitting an order modify from a strategy that only tracks client order IDs; an order submitted but not yet acknowledged (no venue order ID assigned yet); Bucharest/OCO paths where venue ID is unknown.

Understand the failure class

Background: "missing required argument" and "the following required arguments were not provided": what required-argument errors mean and how to fix them — this error's family across 20 libraries.

Related errors


AI-assisted analysis of nautechsystems/nautilus_trader@18893faf8b (2026-09-08). Data as JSON: /api/errors/f6a4daa01290d58c. Report an issue: GitHub.

Appendix: source

Thrown at crates/adapters/binance/src/spot/execution.rs:1861

            self.spawn_task("modify_order_http", async move {
                let result = match command.venue_order_id {
                    Some(venue_order_id) => {
                        http_client
                            .modify_order(
                                account_id,
                                command.instrument_id,
                                venue_order_id,
                                command.client_order_id,
                                order_side,
                                order_type,
                                quantity,
                                time_in_force,
                                command.price,
                                use_gtd,
                            )
                            .await
                    }
                    None => Err(anyhow::anyhow!(BinanceSpotHttpError::ValidationError(
                        "venue_order_id required for modify".to_string()
                    ))),
                };

                match result {
                    Ok(report) => {
                        let ts_now = clock.get_time_ns();
                        let updated_event = OrderUpdated::new(
                            trader_id,
                            command.strategy_id,
                            command.instrument_id,
                            command.client_order_id,
                            report.quantity,
                            UUID4::new(),
                            ts_now,
                            ts_now,
                            false,
                            Some(report.venue_order_id),

View on GitHub (pinned to 18893faf8b)