nautechsystems/nautilus_trader · error
generate_order_status_report requires client_order_id or ven
Error message
generate_order_status_report requires client_order_id or venue_order_id
What it means
After checking instrument_id, generate_order_status_report requires at least one order identifier: a client_order_id or a venue_order_id. Without either, OKX cannot be asked for a specific order, so the adapter bails immediately. It defines the minimum identifying information for a single-order status lookup.
Source
Thrown at crates/adapters/okx/src/execution.rs:1994
self.begin_generation_shutdown();
Ok(())
}
fn dispose(&mut self) -> anyhow::Result<()> {
self.begin_generation_shutdown();
Ok(())
}
async fn generate_order_status_report(
&self,
cmd: &GenerateOrderStatusReport,
) -> anyhow::Result<Option<OrderStatusReport>> {
let Some(instrument_id) = cmd.instrument_id else {
anyhow::bail!("generate_order_status_report requires instrument_id");
};
if cmd.client_order_id.is_none() && cmd.venue_order_id.is_none() {
anyhow::bail!(
"generate_order_status_report requires client_order_id or venue_order_id"
);
}
let order_state = {
let cache = self.core.cache();
cmd.client_order_id.and_then(|client_order_id| {
cache
.order(&client_order_id)
.map(|order| CachedQueryOrderState {
order_type: order.order_type(),
venue_order_id: order.venue_order_id(),
})
})
};
let cached_venue_order_id = order_state.and_then(|state| state.venue_order_id);
let regular_venue_order_id = order_state.and_then(|state| {
if OKX_CONDITIONAL_ORDER_TYPES.contains(&state.order_type) {View on GitHub (pinned to 18893faf8b)
Solutions
- Populate either client_order_id or venue_order_id on the command before calling
- Ensure the upstream report-generation code forwards the identifiers it already holds
- If no identifier is available, this order cannot be queried — log and skip instead of calling
Example fix
// before
let cmd = GenerateOrderStatusReport { instrument_id: Some(id), client_order_id: None, venue_order_id: None, .. };
// after
let cmd = GenerateOrderStatusReport { instrument_id: Some(id), client_order_id: Some(client_order_id), venue_order_id: None, .. }; Defensive patterns
Strategy: validation
Validate before calling
if cmd.instrument_id.is_none() || (cmd.client_order_id.is_none() && cmd.venue_order_id.is_none()) {
return Err(anyhow::anyhow!("order status report needs instrument_id plus one order identifier"));
} Type guard
fn is_queryable(cmd: &GenerateOrderStatusReport) -> bool {
cmd.instrument_id.is_some()
&& (cmd.client_order_id.is_some() || cmd.venue_order_id.is_some())
} Try / catch
match exec.generate_order_status_report(&cmd).await {
Ok(r) => { /* handle */ }
Err(e) => log::warn!("order status report skipped: {e}"),
} Prevention
- Never build report commands without at least one order identifier
- Propagate client_order_id/venue_order_id through reconciliation pipelines instead of dropping Option fields
- Validate commands at construction time, not at request time
When it happens
Trigger: Invoking generate_order_status_report (including via assert_bootstrap_reports) with a GenerateOrderStatusReport where both client_order_id and venue_order_id are None.
Common situations: Reconciliation/bootstrap flows that construct report requests from partial data; deserialization paths that drop order IDs; hand-built commands in tests or custom report pipelines.
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
- generate_order_status_report requires instrument_id
- Either client_order_ids or venue_order_ids must be provided
- Either venue_order_id or client_order_id must be provided
- Either contracts or instrument_ids must be provided
- Either instrument_ids or contracts must be provided
AI-assisted analysis of nautechsystems/nautilus_trader@18893faf8b (2026-09-08).
Data as JSON: /api/errors/e4c5049f2e21c874.
Report an issue: GitHub.