nautechsystems/nautilus_trader · error

Cannot process partial quote for {instrument_id}: missing as

Error message

Cannot process partial quote for {instrument_id}: missing ask_size and no cached value

What it means

Partial-quote merge guard in the quote cache's process: a new BBO update omitted ask_size and no previously cached quote exists for the instrument, so a complete QuoteTick cannot be assembled and the update is rejected.

Source

Thrown at crates/common/src/cache/quote.rs:146

            anyhow::bail!(
                "Cannot process partial quote for {instrument_id}: missing bid_price and no cached value"
            );
        };

        let Some(ask_price) = ask_price.or_else(|| cached.map(|quote| quote.ask_price)) else {
            anyhow::bail!(
                "Cannot process partial quote for {instrument_id}: missing ask_price and no cached value"
            );
        };

        let Some(bid_size) = bid_size.or_else(|| cached.map(|quote| quote.bid_size)) else {
            anyhow::bail!(
                "Cannot process partial quote for {instrument_id}: missing bid_size and no cached value"
            );
        };

        let Some(ask_size) = ask_size.or_else(|| cached.map(|quote| quote.ask_size)) else {
            anyhow::bail!(
                "Cannot process partial quote for {instrument_id}: missing ask_size and no cached value"
            );
        };

        let quote = QuoteTick::new(
            instrument_id,
            bid_price,
            ask_price,
            bid_size,
            ask_size,
            ts_event,
            ts_init,
        );

        self.quotes.insert(instrument_id, quote);

        Ok(quote)
    }

View on GitHub (pinned to 18893faf8b)

Solutions

  1. Ensure the first quote per instrument includes all four fields (bid/ask price and size)
  2. Buffer partial updates until a complete quote seeds the cache
  3. Provide an explicit ask_size when no cached value exists

Example fix

// before
quote_cache.process(instrument_id, bid, ask, bid_size, None, ts_event, ts_init)?;
// after
if !quote_cache.contains(&instrument_id) { return Ok(()); } // wait for full quote
quote_cache.process(instrument_id, bid, ask, bid_size, None, ts_event, ts_init)?;
Defensive patterns

Strategy: try-catch

Validate before calling

fn can_process(cache: &QuoteCache, id: &InstrumentId, ask_size: Option<Quantity>) -> bool {
    ask_size.is_some() || cache.contains(id)
}

Try / catch

match quote_cache.process(instrument_id, bid_price, ask_price, bid_size, ask_size, ts_event, ts_init) {
    Ok(quote) => /* forward quote */,
    Err(e) if e.to_string().contains("missing ask_size") => { /* skip partial update */ }
    Err(e) => return Err(e.into()),
}

Prevention

When it happens

Trigger: First call to process for an instrument (or after clear()) with ask_size=None while the other three fields are provided.

Common situations: Cold-start or post-reconnect delta feeds omitting ask size; feeds whose initial tick carries only prices and bid size; size-less quote sources that skip optional size fields on the first message.

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