nautechsystems/nautilus_trader · error

{e}

Error message

{e}

What it means

During mass status generation the adapter builds a GenerateOrderStatusReports command with its builder (open_only=true, optional lookback start). If the builder's own validation rejects the input — e.g. an invalid ts_init/start combination — the error is re-wrapped into anyhow via map_err(|e| anyhow!("{e}")) at spot/execution.rs:1417.

Source

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

        let ts_now = self.clock.get_time_ns();

        let start = if let Some(mins) = lookback_mins {
            let lookback_ns = checked_mins_to_nanos(mins)
                .context("lookback minutes exceed the nanosecond range")?;
            Some(UnixNanos::from(ts_now.as_u64().saturating_sub(lookback_ns)))
        } else {
            None
        };

        // Binance requires instrument_id for historical orders (open_only=false).
        // Use open_only=true for mass status to get all open orders across instruments.
        let order_cmd = GenerateOrderStatusReportsBuilder::default()
            .ts_init(ts_now)
            .open_only(true)
            .start(start)
            .build()
            .map_err(|e| anyhow::anyhow!("{e}"))?;

        let position_cmd = GeneratePositionStatusReportsBuilder::default()
            .ts_init(ts_now)
            .start(start)
            .build()
            .map_err(|e| anyhow::anyhow!("{e}"))?;

        let (order_reports, position_reports) = tokio::try_join!(
            self.generate_order_status_reports(&order_cmd),
            self.generate_position_status_reports(&position_cmd),
        )?;

        let mut instrument_ids: Vec<_> = order_reports
            .iter()
            .map(|report| report.instrument_id)
            .collect();
        {
            let cache = self.core.cache();

View on GitHub (pinned to a4b06ed870)

Solutions

  1. Check the start/lookback values passed to mass status are valid unix nanosecond timestamps
  2. Ensure all nautilus crates in the workspace resolve to the same version (cargo tree -d)
  3. If inputs look valid, capture the builder error text and report it to the NautilusTrader maintainers
Defensive patterns

Strategy: validation

Validate before calling

// sanity-check the lookback before triggering mass status
let start = UnixNanos::from((now_ms - lookback_ms) * 1_000_000);
anyhow::ensure!(start.as_u64() < ts_now.as_u64(), "lookback start must precede now");

Try / catch

match generate_mass_status(cmd).await {
    Err(e) => {
        // builder validation failure: log e, verify crate versions (cargo tree -d),
        // do not retry with identical inputs
    }
}

Prevention

When it happens

Trigger: generate_mass_status invoked with a start/lookback the GenerateOrderStatusReportsBuilder rejects; in practice this signals a malformed command or version skew between nautilus crates rather than a venue error.

Common situations: Mixed crate versions after a partial upgrade changing command validation rules; custom code driving the Rust execution client with hand-built lookbacks; regressions in command construction.

Related errors


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