{"record":{"id":"35173a9f994c5232","repo":"nautechsystems/nautilus_trader","slug":"invalid-statusmsg-trading-event-was-value","errorCode":null,"errorMessage":"Invalid `StatusMsg` trading_event, was '{value}'","messagePattern":"Invalid `StatusMsg` trading_event, was '(.+?)'","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"crates/adapters/databento/src/decode/primitives.rs","lineNumber":216,"sourceCode":"        invalid => anyhow::bail!(\"Invalid `StatusMsg` reason, was '{invalid}'\"),\n    };\n\n    Ok(Some(Ustr::from(value_str)))\n}\n\n/// Parses a Databento status trading event code into a human-readable string.\n///\n/// # Errors\n///\n/// Returns an error if `value` is an invalid status trading event code.\npub fn parse_status_trading_event(value: u16) -> anyhow::Result<Option<Ustr>> {\n    let value_str = match value {\n        0 => return Ok(None),\n        1 => \"No cancel\",\n        2 => \"Change trading session\",\n        3 => \"Implied matching on\",\n        4 => \"Implied matching off\",\n        _ => anyhow::bail!(\"Invalid `StatusMsg` trading_event, was '{value}'\"),\n    };\n\n    Ok(Some(Ustr::from(value_str)))\n}\n\n/// Decodes a price, returning an error if undefined.\n///\n/// Databento uses `i64::MAX` as a sentinel value for unset/null prices (see\n/// [`UNDEF_PRICE`](https://docs.rs/dbn/latest/dbn/constant.UNDEF_PRICE.html)).\n///\n/// # Errors\n///\n/// Returns an error if `value` is `i64::MAX` (undefined).\n#[inline(always)]\npub fn decode_price(value: i64, precision: u8, field_name: &str) -> anyhow::Result<Price> {\n    if value == i64::MAX {\n        anyhow::bail!(\"Missing required price for `{field_name}`\")\n    } else {","sourceCodeStart":198,"sourceCodeEnd":234,"githubUrl":"https://github.com/nautechsystems/nautilus_trader/blob/18893faf8b356be3320add8de2f861b0b647cf06/crates/adapters/databento/src/decode/primitives.rs#L198-L234","documentation":"`parse_status_trading_event` maps Databento status trading-event codes (0 none, 1 no cancel, 2 change trading session, 3/4 implied matching on/off) to strings. Code 0 means 'no event' and returns Ok(None); any other unmapped code bails with this message.","triggerScenarios":"Decoding a `StatusMsg` whose `trading_event` field is a code outside {0,1,2,3,4}, typically via `decode_status_msg` while processing instrument status records.","commonSituations":"New trading-event codes introduced by Databento or an exchange; version skew between the dbn crate and the adapter's mapping table; unexpected status records from less common datasets.","solutions":["Upgrade the adapter crate so the trading-event table includes new codes","Look up the numeric code in Databento's status documentation","Skip or log-and-continue on such status records until supported","Report the unmapped code upstream"],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":"fn is_known_trading_event(v: u8) -> bool { matches!(v, 0..=4) } // verify against current adapter table","typeGuard":null,"tryCatchPattern":"match decode_status_msg(msg) {\n    Ok(s) => s,\n    Err(e) if e.to_string().contains(\"Invalid `StatusMsg` trading_event\") => {\n        log::warn!(\"unknown trading_event code; skipping status record\");\n        None\n    }\n    Err(e) => return Err(e),\n}","preventionTips":["Upgrade the adapter when Databento adds trading-event codes","Log the raw trading_event number on decode failure","Handle status decode failures gracefully — skip rather than abort the stream"],"tags":["rust","databento","status","enum"],"backgroundTag":"invalid-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"}