nautechsystems/nautilus_trader · error

L3 queue update should be processed

Error message

L3 queue update should be processed

What it means

In the matching_engine benchmark, `process_order_book_delta` returns a Result and this expect() asserts that every queued L3 (MBO) delta applies cleanly to the L3_MBO book. The library panics with this message when any delta is rejected during the benchmarked batch, meaning the benchmark invariant (all pre-built deltas are valid for the engine's instrument/book state) was violated. It is a deliberate hard failure so benchmark results are never produced from silently dropped updates.

Source

Thrown at crates/execution/benches/matching_engine.rs:272

                        assert_events(state, EventCounts::default());
                        assert_order_status(state, OrderStatus::Accepted, order_count);
                    },
                )
            });
        });

        // Per-order L3 updates expose the tracked-order lookup cost
        group.bench_function(BenchmarkId::new("delta_l3_update", order_count), |b| {
            b.iter_custom(|iters| {
                run_iterations(
                    iters,
                    || build_queue_engine(BookType::L3_MBO, &orders, Some(&bid), None),
                    |state| {
                        for delta in &l3_updates {
                            state
                                .engine
                                .process_order_book_delta(black_box(delta))
                                .expect("L3 queue update should be processed");
                        }
                    },
                    |state| {
                        assert_eq!(
                            state.engine.get_book().update_count,
                            (MARKET_DATA_COUNT + 1) as u64,
                        );
                        assert_events(state, EventCounts::default());
                        assert_order_status(state, OrderStatus::Accepted, order_count);
                    },
                )
            });
        });

        // L1 quotes repeatedly check orders waiting for their price to reach the BBO
        group.bench_function(BenchmarkId::new("quote_l1_pending", order_count), |b| {
            b.iter_custom(|iters| {
                run_iterations(

View on GitHub (pinned to 18893faf8b)

Solutions

  1. Inspect the first failing delta and confirm its instrument_id, action, and order_id are consistent with the orders seeded by `build_queue_engine`
  2. Regenerate `l3_updates` from the same seed/order set used to build the engine so deltas are guaranteed applicable
  3. Run the bench with a debug build or add temporary logging in process_order_book_delta to see the rejection reason
  4. If engine validation rules changed after a version upgrade, update the benchmark's delta fixtures to satisfy the new rules

Example fix

// before
let l3_updates = build_l3_updates(&orders); // built from a different order set
// after
let l3_updates = build_l3_updates(&orders, &bid); // derive deltas from the same seeded orders/engine state
Defensive patterns

Strategy: validation

Validate before calling

if state.engine.get_book().instrument_id != delta.instrument_id {
    panic!("delta instrument mismatch: {:?}", delta.instrument_id);
}
for delta in &l3_updates {
    assert!(state.engine.process_order_book_delta(delta).is_ok(), "delta rejected: {delta:?}");
}

Prevention

When it happens

Trigger: Calling `engine.process_order_book_delta(delta)` with a delta the L3_MBO book cannot apply: a delta whose instrument_id does not match the book, an order/event sequence violating MBO constraints (e.g. update/DELETE for an unknown order id), a malformed or out-of-sequence delta in `l3_updates`, or processing after the book was cleared/reset so the update_count assertion context no longer holds.

Common situations: Modifying `build_queue_engine` or the synthetic `l3_updates` generator so deltas no longer match the seeded orders; changing MARKET_DATA_COUNT or the initial order set without regenerating deltas; swapping BookType so MBO-specific deltas feed a non-MBO book; version changes to the matching engine that add new delta validation.

Understand the failure class

Background: "This is a bug, please report it": internal invariant violations, unreachable panics, and SNH errors explained — this error's family across 47 libraries.

Related errors


AI-assisted analysis of nautechsystems/nautilus_trader@18893faf8b (2026-09-08). Data as JSON: /api/errors/0d4df9ae27af817c. Report an issue: GitHub.