nautechsystems/nautilus_trader · error

generate_order_status_report requires venue_order_id

Error message

generate_order_status_report requires venue_order_id

What it means

generate_order_status_report_impl requires a venue order id to query Polymarket. resolve_venue_order_id could not derive one from cmd.venue_order_id or cmd.client_order_id, so the request is rejected before any HTTP call.

Source

Thrown at crates/adapters/polymarket/src/execution/reports.rs:518

                Ok(None) => {
                    log::warn!("Order {venue_order_id_str} not found (empty response)");
                }
                Err(e) => {
                    log::warn!("Failed to query order {venue_order_id_str}: {e}");
                }
            }
            Ok(())
        });
    }

    pub(super) async fn generate_order_status_report_impl(
        &self,
        cmd: &GenerateOrderStatusReport,
    ) -> anyhow::Result<Option<OrderStatusReport>> {
        let Some(venue_order_id) =
            self.resolve_venue_order_id(cmd.venue_order_id, cmd.client_order_id)
        else {
            anyhow::bail!("generate_order_status_report requires venue_order_id");
        };

        let Some(instrument_id) = cmd.instrument_id else {
            anyhow::bail!("generate_order_status_report requires instrument_id");
        };

        let authority = self.resolve_target_order_authority(
            cmd.client_order_id,
            venue_order_id,
            Some(instrument_id),
        )?;
        let cached_authority = authority
            .client_order_id
            .map(|_| authority.require_cached_base_limit(venue_order_id).cloned())
            .transpose()?;
        let instrument = self
            .core
            .cache()

View on GitHub (pinned to 18893faf8b)

Solutions

  1. Set cmd.venue_order_id to the id returned when the order was submitted.
  2. Provide a resolvable client_order_id (one previously registered/submitted through this client) so resolve_venue_order_id can map it.
  3. Look up the venue order id from persisted order state or a prior OrderStatusReport before issuing the request.

Example fix

// before
let cmd = GenerateOrderStatusReport { instrument_id: Some(instrument_id), ..Default::default() };
// after
let cmd = GenerateOrderStatusReport { venue_order_id: Some(venue_order_id), instrument_id: Some(instrument_id), ..Default::default() };
Defensive patterns

Strategy: validation

Validate before calling

// Rust: require an order identifier before building the request
fn status_cmd_ready(cmd: &GenerateOrderStatusReport) -> bool {
    cmd.venue_order_id.is_some() || cmd.client_order_id.is_some()
}
assert!(status_cmd_ready(&cmd));

Type guard

fn has_order_id(cmd: &GenerateOrderStatusReport) -> Option<VenueOrderId> {
    cmd.venue_order_id.or(cmd.client_order_id.map(resolve_from_registry))
}

Prevention

When it happens

Trigger: Calling generate_order_status_report with a GenerateOrderStatusReport that has neither venue_order_id set nor a client_order_id that resolve_venue_order_id can map to a venue order id.

Common situations: Constructing the report request manually with only an instrument_id; a client_order_id that was never registered with the venue so no mapping exists; dropping the venue_order_id from a persisted report before requesting a status refresh.

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/bc282a5ce545fb26. Report an issue: GitHub.