nautechsystems/nautilus_trader · error

generate_order_status_report requires instrument_id

Error message

generate_order_status_report requires instrument_id

What it means

After resolving the venue order id, generate_order_status_report_impl also requires an instrument_id to resolve the target order authority and route the query. A GenerateOrderStatusReport without instrument_id is rejected before contacting the venue.

Source

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

                    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()
            .instrument(&instrument_id)
            .cloned()
            .with_context(|| format!("instrument {instrument_id} not cached"))?;
        let size_prec = instrument.size_precision();

View on GitHub (pinned to 18893faf8b)

Solutions

  1. Set cmd.instrument_id to the Nautilus instrument id the order belongs to.
  2. Derive instrument_id from the stored order or prior report before requesting a status update.
  3. Ensure your persistence layer records instrument_id alongside venue_order_id.

Example fix

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

Strategy: validation

Validate before calling

// Rust: require instrument_id before building the request
fn status_cmd_has_instrument(cmd: &GenerateOrderStatusReport) -> bool {
    cmd.instrument_id.is_some()
}
assert!(status_cmd_has_instrument(&cmd));

Type guard

fn with_instrument(cmd: GenerateOrderStatusReport, instrument_id: InstrumentId) -> GenerateOrderStatusReport {
    GenerateOrderStatusReport { instrument_id: Some(instrument_id), ..cmd }
}

Prevention

When it happens

Trigger: Calling generate_order_status_report with venue_order_id (or resolvable client_order_id) set but cmd.instrument_id left as None.

Common situations: Building the request from a partial record where instrument metadata was not persisted; generic status-polling code that fills order ids but not the instrument; copying a request struct between markets without updating instrument_id.

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