{"record":{"id":"5cccf9519c05431f","repo":"nautechsystems/nautilus_trader","slug":"lighter-only-supports-l2-mbp-order-book-label","errorCode":null,"errorMessage":"Lighter only supports L2_MBP order book {label}","messagePattern":"Lighter only supports L2_MBP order book (.+?)","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"crates/adapters/lighter/src/data/mod.rs","lineNumber":1846,"sourceCode":"    end_nanos: Option<UnixNanos>,\n) -> bool {\n    start_nanos.is_none_or(|start| ts_event >= start) && end_nanos.is_none_or(|end| ts_event <= end)\n}\n\n/// Returns an error if `book_type` is not [`BookType::L2_MBP`].\n///\n/// Lighter publishes only level-aggregated book updates, so any other book\n/// type cannot be served by the WebSocket feed.\nfn validate_book_deltas_subscription(book_type: BookType) -> anyhow::Result<()> {\n    validate_l2_mbp_book_type(book_type, \"deltas\")\n}\n\nfn validate_book_depth10_subscription(book_type: BookType) -> anyhow::Result<()> {\n    validate_l2_mbp_book_type(book_type, \"depth10\")\n}\n\nfn validate_l2_mbp_book_type(book_type: BookType, label: &str) -> anyhow::Result<()> {\n    anyhow::ensure!(\n        book_type == BookType::L2_MBP,\n        \"Lighter only supports L2_MBP order book {label}\",\n    );\n    Ok(())\n}\n\n#[cfg(test)]\nmod tests {\n    use std::{num::NonZeroUsize, time::Duration};\n\n    use axum::{\n        Router,\n        extract::Query,\n        http::StatusCode,\n        response::{IntoResponse, Response},\n        routing::get,\n    };\n    use jiff::Timestamp;","sourceCodeStart":1828,"sourceCodeEnd":1864,"githubUrl":"https://github.com/nautechsystems/nautilus_trader/blob/18893faf8b356be3320add8de2f861b0b647cf06/crates/adapters/lighter/src/data/mod.rs#L1828-L1864","documentation":"Lighter order book data only supports the L2_MBP (level-2 market-by-price) BookType. The helper validate_l2_mbp_book_type, called from validate_book_deltas_subscription and validate_book_depth10_subscription, rejects any other book type (e.g. L3_MBO) with this message; {label} indicates which subscription kind (deltas or depth10) was requested.","triggerScenarios":"Subscribing to book deltas or depth10 with a BookType other than BookType::L2_MBP in the subscription's data type.","commonSituations":"Configuring an L3/order-book-ticks book type copied from another venue adapter; a default book type in a generic config that isn't L2_MBP.","solutions":["Set the order book subscription's BookType to BookType::L2_MBP.","If you need L3/MBO granularity, use a different venue that supports it.","Check the data type in your subscribe/config payload for typos or wrong defaults.","For depth10, keep BookType::L2_MBP — only the label differs, the requirement is the same."],"exampleFix":"// before\nOrderBookSub(Entry::new(instrument_id, BookType::L3_MBO))\n// after\nOrderBookSub(Entry::new(instrument_id, BookType::L2_MBP))","handlingStrategy":"validation","validationCode":"if book_type != BookType::L2_MBP {\n    return Err(anyhow!(\"Lighter requires BookType::L2_MBP for book subscriptions\"));\n}","typeGuard":null,"tryCatchPattern":"match client.subscribe_book_deltas(sub) {\n    Err(e) if e.to_string().contains(\"only supports L2_MBP\") => {\n        // re-subscribe with BookType::L2_MBP\n    }\n    r => r?,\n}","preventionTips":["Always configure BookType::L2_MBP for Lighter book streams.","Do not copy L3/MBO book configs from other venue adapters.","Validate book type in your strategy config loader."],"tags":["order-book","book-type","validation","subscription"],"backgroundTag":"unsupported-enum-value","analyzedSha":"18893faf8b356be3320add8de2f861b0b647cf06","analyzedAt":"2026-09-08T20:49:34.690Z","contentChangedAt":"2026-09-08T20:49:34.690Z","schemaVersion":2},"datasetVersion":"2026-09-14T00:17:10.932Z"}