nautechsystems/nautilus_trader · error

Cannot process partial quote for {instrument_id}: missing as

Error message

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

What it means

Partial-quote resolution in the quote cache: each field falls back to the last cached quote for the instrument; a missing ask_price with no cached value leaves the quote incomplete, so processing fails instead of fabricating a price.

Source

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

        instrument_id: InstrumentId,
        bid_price: Option<Price>,
        ask_price: Option<Price>,
        bid_size: Option<Quantity>,
        ask_size: Option<Quantity>,
        ts_event: UnixNanos,
        ts_init: UnixNanos,
    ) -> anyhow::Result<QuoteTick> {
        let cached = self.quotes.get(&instrument_id);

        // Resolve each field: use provided value or fall back to cache
        let Some(bid_price) = bid_price.or_else(|| cached.map(|quote| quote.bid_price)) else {
            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,

View on GitHub (pinned to 18893faf8b)

Solutions

  1. Ensure the first update for an instrument is a complete quote (all four fields)
  2. Hold partial updates until a full quote populates the cache
  3. Pass an explicit ask_price when no cached value exists

Example fix

// before
quote_cache.process(instrument_id, bid, None, bid_size, ask_size, ts_event, ts_init)?;
// after
if !quote_cache.contains(&instrument_id) { return; } // skip until full quote arrives
quote_cache.process(instrument_id, bid, None, bid_size, ask_size, ts_event, ts_init)?;
Defensive patterns

Strategy: try-catch

Validate before calling

fn can_process(cache: &QuoteCache, id: &InstrumentId, ask_price: Option<Price>) -> bool {
    ask_price.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_price") => { /* skip partial update */ }
    Err(e) => return Err(e.into()),
}

Prevention

When it happens

Trigger: First (or post-clear) call to QuoteCache::process for an instrument with ask_price=None, while bid_price/bid_size/ask_size are supplied.

Common situations: Delta feeds whose first tick omits the ask side; cache cleared on reconnect followed by partial updates; cold-start subscribers joining mid-session.

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