{"record":{"id":"ae84822ef635584a","repo":"nautechsystems/nautilus_trader","slug":"invalid-value-for-update-action-update-action","errorCode":null,"errorMessage":"Invalid value for `update_action`: {update_action}","messagePattern":"Invalid value for `update_action`: (.+?)","errorType":"exception","errorClass":"anyhow::Error","httpStatus":null,"severity":"error","filePath":"crates/adapters/databento/src/decode/custom.rs","lineNumber":87,"sourceCode":"pub fn decode_statistics_msg(\n    msg: &dbn::StatMsg,\n    instrument_id: InstrumentId,\n    price_precision: u8,\n    ts_init: Option<UnixNanos>,\n) -> anyhow::Result<Option<DatabentoStatistics>> {\n    let Some(stat_type) = u8::try_from(msg.stat_type)\n        .ok()\n        .and_then(DatabentoStatisticType::from_u8)\n    else {\n        log::warn!(\n            \"Skipping unsupported `stat_type` {} for {instrument_id}\",\n            msg.stat_type,\n        );\n        return Ok(None);\n    };\n    let update_action =\n        DatabentoStatisticUpdateAction::from_u8(msg.update_action).ok_or_else(|| {\n            anyhow::anyhow!(\"Invalid value for `update_action`: {}\", msg.update_action)\n        })?;\n    let ts_event = msg.ts_recv.into();\n    let ts_init = ts_init.unwrap_or(ts_event);\n\n    Ok(Some(DatabentoStatistics::new(\n        instrument_id,\n        stat_type,\n        update_action,\n        decode_optional_price(msg.price, price_precision),\n        decode_optional_quantity(msg.quantity)?,\n        msg.channel_id,\n        msg.stat_flags,\n        msg.sequence,\n        msg.ts_ref.into(),\n        msg.ts_in_delta,\n        msg.hd.ts_event.into(),\n        ts_event,\n        ts_init,","sourceCodeStart":69,"sourceCodeEnd":105,"githubUrl":"https://github.com/nautechsystems/nautilus_trader/blob/18893faf8b356be3320add8de2f861b0b647cf06/crates/adapters/databento/src/decode/custom.rs#L69-L105","documentation":"decode_statistics_msg converts a Databento statistics record into a DatabentoStatistics event. The record's update_action byte must map to a known DatabentoStatisticUpdateAction; any unmapped value aborts the decode with this anyhow error instead of producing an event.","triggerScenarios":"Feeding a Statistics record whose msg.update_action raw u8 is not recognized by DatabentoStatisticUpdateAction::from_u8 — typically a DBN schema revision introducing a new update action the decoder does not know.","commonSituations":"Replaying historical data recorded with a newer databento DBN version than the adapter supports; unexpected exchange-side statistics update actions in live streams; corrupted records.","solutions":["Upgrade nautilus-trader / the databento adapter to a version supporting the newer DBN schema","Log and skip unknown update_action values instead of hard-failing (mirroring the unknown stat_type handling)","Check the record's DBN version and the update_action value to confirm whether the schema is newer","Report/patch DatabentoStatisticUpdateAction::from_u8 to map the new value"],"exampleFix":"// before\nlet update_action = DatabentoStatisticUpdateAction::from_u8(msg.update_action)\n    .ok_or_else(|| anyhow!(\"Invalid value for `update_action`: {}\", msg.update_action))?;\n// after\nlet Some(update_action) = DatabentoStatisticUpdateAction::from_u8(msg.update_action) else {\n    log::warn(\"Skipping statistics with unknown update_action {}\", msg.update_action);\n    return Ok(None);\n};","handlingStrategy":"validation","validationCode":"// Rust\nlet ok = DatabentoStatisticUpdateAction::from_u8(msg.update_action).is_some();","typeGuard":null,"tryCatchPattern":"// Rust\nErr(e) => log::warn(\"skip: {e:#}\"),","preventionTips":["Align DBN versions","Upgrade adapter","Skip unknown values","Pre-scan datasets"],"tags":["rust","databento","dbn-schema","decode"],"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"}