{"record":{"id":"a257904fcb2d6967","repo":"nautechsystems/nautilus_trader","slug":"sbe-decoding-requires-the-sbe-feature","errorCode":null,"errorMessage":"SBE decoding requires the `sbe` feature","messagePattern":"SBE decoding requires the `sbe` feature","errorType":"exception","errorClass":"anyhow::Error","httpStatus":null,"severity":"error","filePath":"crates/common/src/msgbus/external/codec/sbe_unavailable.rs","lineNumber":30,"sourceCode":"//  See the License for the specific language governing permissions and\n//  limitations under the License.\n// -------------------------------------------------------------------------------------------------\n\nuse std::any::Any;\n\nuse bytes::Bytes;\nuse nautilus_model::data::{\n    Bar, FundingRateUpdate, IndexPriceUpdate, MarkPriceUpdate, OptionGreeks, OrderBookDeltas,\n    OrderBookDepth10, QuoteTick, TradeTick,\n};\n\nuse super::PayloadCodecError;\nuse crate::msgbus::BusPayloadType;\n\nmacro_rules! define_deserializer {\n    ($fn_name:ident, $ty:ty) => {\n        pub(crate) fn $fn_name(_payload: &[u8]) -> anyhow::Result<$ty> {\n            anyhow::bail!(\"SBE decoding requires the `sbe` feature\")\n        }\n    };\n}\n\ndefine_deserializer!(deserialize_order_book_deltas, OrderBookDeltas);\ndefine_deserializer!(deserialize_order_book_depth10, OrderBookDepth10);\ndefine_deserializer!(deserialize_quote, QuoteTick);\ndefine_deserializer!(deserialize_trade, TradeTick);\ndefine_deserializer!(deserialize_bar, Bar);\ndefine_deserializer!(deserialize_mark_price, MarkPriceUpdate);\ndefine_deserializer!(deserialize_index_price, IndexPriceUpdate);\ndefine_deserializer!(deserialize_funding_rate, FundingRateUpdate);\ndefine_deserializer!(deserialize_option_greeks, OptionGreeks);\n\npub(super) fn serialize_payload(\n    payload_type: BusPayloadType,\n    _message: &dyn Any,\n) -> Result<Bytes, PayloadCodecError> {","sourceCodeStart":12,"sourceCodeEnd":48,"githubUrl":"https://github.com/nautechsystems/nautilus_trader/blob/18893faf8b356be3320add8de2f861b0b647cf06/crates/common/src/msgbus/external/codec/sbe_unavailable.rs#L12-L48","documentation":"The message bus SBE codec stubs are compiled in when the `sbe` cargo feature is disabled. Every SBE deserializer (e.g. for OrderBookDeltas or OrderBookDepth10) immediately bails with this error because SBE decoding is simply not compiled into the binary. The library throws it to make the missing-feature condition explicit instead of returning garbage or panicking.","triggerScenarios":"Calling any `deserialize_*` function in crates/common/src/msgbus/external/codec/sbe_unavailable.rs (deserialize_order_book_deltas, deserialize_order_book_depth10) while the crate was built without the `sbe` feature — e.g. decoding an SBE-encoded payload from an external message bus endpoint.","commonSituations":"Running a default `cargo build` (features off) and then pointing the message bus at a topic that publishes SBE-framed payloads; a workspace depending on nautilus_common without enabling `features = [\"sbe\"]`; CI or docker images built with default features.","solutions":["Enable the `sbe` feature: add `features = [\"sbe\"]` to the nautilus_common dependency in Cargo.toml or build with `cargo build --features sbe`.","Switch the bus payload codec to a supported one (e.g. JSON) so SBE deserializers are never invoked.","Verify with `cargo tree -e features` that the feature actually reaches the final binary and not just an intermediate crate."],"exampleFix":"// before (Cargo.toml)\nnautilus-common = \"0.x\"\n// after\nnautilus-common = { version = \"0.x\", features = [\"sbe\"] }","handlingStrategy":"validation","validationCode":"# build-time / runtime check that the sbe feature is present\nif not hasattr(codec_module, \"sbe_enabled\") or not codec_module.sbe_enabled:\n    raise RuntimeError(\"SBE codec unavailable: rebuild with --features sbe\")","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Enable the `sbe` feature in the workspace dependency declaration so all binaries get it.","Add a CI build with production feature flags identical to release.","Document which payload codecs require which features near the bus configuration."],"tags":["feature-flag","serialization","sbe","message-bus"],"backgroundTag":"feature-not-enabled","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"}