{"record":{"id":"0d4df9ae27af817c","repo":"nautechsystems/nautilus_trader","slug":"l3-queue-update-should-be-processed","errorCode":null,"errorMessage":"L3 queue update should be processed","messagePattern":"L3 queue update should be processed","errorType":"panic","errorClass":null,"httpStatus":null,"severity":"error","filePath":"crates/execution/benches/matching_engine.rs","lineNumber":272,"sourceCode":"                        assert_events(state, EventCounts::default());\n                        assert_order_status(state, OrderStatus::Accepted, order_count);\n                    },\n                )\n            });\n        });\n\n        // Per-order L3 updates expose the tracked-order lookup cost\n        group.bench_function(BenchmarkId::new(\"delta_l3_update\", order_count), |b| {\n            b.iter_custom(|iters| {\n                run_iterations(\n                    iters,\n                    || build_queue_engine(BookType::L3_MBO, &orders, Some(&bid), None),\n                    |state| {\n                        for delta in &l3_updates {\n                            state\n                                .engine\n                                .process_order_book_delta(black_box(delta))\n                                .expect(\"L3 queue update should be processed\");\n                        }\n                    },\n                    |state| {\n                        assert_eq!(\n                            state.engine.get_book().update_count,\n                            (MARKET_DATA_COUNT + 1) as u64,\n                        );\n                        assert_events(state, EventCounts::default());\n                        assert_order_status(state, OrderStatus::Accepted, order_count);\n                    },\n                )\n            });\n        });\n\n        // L1 quotes repeatedly check orders waiting for their price to reach the BBO\n        group.bench_function(BenchmarkId::new(\"quote_l1_pending\", order_count), |b| {\n            b.iter_custom(|iters| {\n                run_iterations(","sourceCodeStart":254,"sourceCodeEnd":290,"githubUrl":"https://github.com/nautechsystems/nautilus_trader/blob/18893faf8b356be3320add8de2f861b0b647cf06/crates/execution/benches/matching_engine.rs#L254-L290","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","solutions":["Inspect the first failing delta and confirm its instrument_id, action, and order_id are consistent with the orders seeded by `build_queue_engine`","Regenerate `l3_updates` from the same seed/order set used to build the engine so deltas are guaranteed applicable","Run the bench with a debug build or add temporary logging in process_order_book_delta to see the rejection reason","If engine validation rules changed after a version upgrade, update the benchmark's delta fixtures to satisfy the new rules"],"exampleFix":"// before\nlet l3_updates = build_l3_updates(&orders); // built from a different order set\n// after\nlet l3_updates = build_l3_updates(&orders, &bid); // derive deltas from the same seeded orders/engine state","handlingStrategy":"validation","validationCode":"if state.engine.get_book().instrument_id != delta.instrument_id {\n    panic!(\"delta instrument mismatch: {:?}\", delta.instrument_id);\n}\nfor delta in &l3_updates {\n    assert!(state.engine.process_order_book_delta(delta).is_ok(), \"delta rejected: {delta:?}\");\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Generate benchmark deltas from the exact same seeded order set used to build the engine","Assert on the first delta outside the timed loop to fail fast with context","Re-run bench fixtures after any matching-engine validation change","Keep MARKET_DATA_COUNT and delta counts derived from one constant"],"tags":["rust","benchmark","order-book","panic"],"backgroundTag":"internal-invariant-violation","analyzedSha":"18893faf8b356be3320add8de2f861b0b647cf06","analyzedAt":"2026-09-08T20:49:34.690Z","contentChangedAt":"2026-09-08T20:49:34.690Z","schemaVersion":2},"datasetVersion":"2026-09-14T05:17:10.506Z"}