{"record":{"id":"31542b6e684c70c9","repo":"nautechsystems/nautilus_trader","slug":"invalid-mbomsg-parsing-combination","errorCode":null,"errorMessage":"Invalid `MboMsg` parsing combination","messagePattern":"Invalid `MboMsg` parsing combination","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"crates/adapters/databento/src/decode/market_data.rs","lineNumber":801,"sourceCode":"    ts_init: Option<UnixNanos>,\n    include_trades: bool,\n    bars_timestamp_on_close: bool,\n) -> anyhow::Result<(Option<Data>, Option<Data>)> {\n    let result = if let Some(msg) = record.get::<dbn::MboMsg>() {\n        let ts_init = determine_timestamp(ts_init, msg.ts_recv.into());\n        let result = decode_mbo_msg(\n            msg,\n            instrument_id,\n            price_precision,\n            Some(ts_init),\n            include_trades,\n        )?;\n\n        match result {\n            (Some(delta), None) => (Some(Data::BookDelta(delta)), None),\n            (None, Some(trade)) => (Some(Data::Trade(trade)), None),\n            (None, None) => (None, None),\n            _ => anyhow::bail!(\"Invalid `MboMsg` parsing combination\"),\n        }\n    } else if let Some(msg) = record.get::<dbn::TradeMsg>() {\n        let ts_init = determine_timestamp(ts_init, msg.ts_recv.into());\n        let trade = decode_trade_msg(msg, instrument_id, price_precision, Some(ts_init))?;\n        (Some(Data::Trade(trade)), None)\n    } else if let Some(msg) = record.get::<dbn::Mbp1Msg>() {\n        let ts_init = determine_timestamp(ts_init, msg.ts_recv.into());\n        let (maybe_quote, maybe_trade) = decode_mbp1_msg(\n            msg,\n            instrument_id,\n            price_precision,\n            Some(ts_init),\n            include_trades,\n        )?;\n        (maybe_quote.map(Data::Quote), maybe_trade.map(Data::Trade))\n    } else if let Some(msg) = record.get::<dbn::Bbo1SMsg>() {\n        let ts_init = determine_timestamp(ts_init, msg.ts_recv.into());\n        let maybe_quote = decode_bbo_msg(msg, instrument_id, price_precision, Some(ts_init))?;","sourceCodeStart":783,"sourceCodeEnd":819,"githubUrl":"https://github.com/nautechsystems/nautilus_trader/blob/18893faf8b356be3320add8de2f861b0b647cf06/crates/adapters/databento/src/decode/market_data.rs#L783-L819","documentation":"For `MboMsg` records, `decode_record` expects the decoded result to be exactly one of: a book delta, a trade, or nothing. Any other combination (e.g. both a delta and a trade produced simultaneously) indicates an internal decoding invariant violation and is rejected.","triggerScenarios":"Decoding an MBO record (rtype 0 family / TCBBO paths) where the MBO decoder returns both `Some(delta)` and `Some(trade)` at once — a bug or unhandled case in `decode_mbo_msg` rather than bad user input.","commonSituations":"Running against new Databento record contents that exercise an untested MBO decode branch; custom builds where decode functions were modified; generally a decoder bug report scenario.","solutions":["Check the decoder version and upgrade — this usually indicates a library bug","Capture the offending record (rtype, action, fields) and file a bug with the adapter maintainers","Verify no local modifications changed `decode_mbo_msg` return semantics"],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":null,"typeGuard":null,"tryCatchPattern":"match decode_record(record) {\n    Ok(data) => data,\n    Err(e) if e.to_string().contains(\"Invalid `MboMsg` parsing combination\") => {\n        log::error!(\"decoder invariant violated; capture record and report bug\");\n        None // skip record\n    }\n    Err(e) => return Err(e.into()),\n}","preventionTips":["Keep the adapter crate at the latest release","Avoid locally modifying decode_mbo_msg return semantics","When reproducing, save the raw DBN record for the bug report"],"tags":["rust","databento","mbo","internal"],"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-14T00:17:10.932Z"}