{"record":{"id":"780c248777e87ed3","repo":"nautechsystems/nautilus_trader","slug":"handle-depth-impl-err","errorCode":null,"errorMessage":"`handle_depth` {IMPL_ERR} `{}`","messagePattern":"`handle_depth` (.+?) `(.+?)`","errorType":"panic","errorClass":null,"httpStatus":null,"severity":"critical","filePath":"crates/indicators/src/indicator.rs","lineNumber":44,"sourceCode":"\n#[allow(unused_variables)]\npub trait Indicator {\n    fn name(&self) -> String;\n\n    fn has_inputs(&self) -> bool;\n\n    fn initialized(&self) -> bool;\n\n    fn handle_delta(&mut self, delta: &OrderBookDelta) {\n        panic!(\"`handle_delta` {IMPL_ERR} `{}`\", self.name());\n    }\n\n    fn handle_deltas(&mut self, deltas: &OrderBookDeltas) {\n        panic!(\"`handle_deltas` {IMPL_ERR} `{}`\", self.name());\n    }\n\n    fn handle_depth(&mut self, depth: &OrderBookDepth10) {\n        panic!(\"`handle_depth` {IMPL_ERR} `{}`\", self.name());\n    }\n\n    fn handle_book(&mut self, book: &OrderBook) {\n        panic!(\"`handle_book_mbo` {IMPL_ERR} `{}`\", self.name());\n    }\n\n    /// Updates the indicator with the given quote tick.\n    ///\n    /// # Errors\n    ///\n    /// Returns an error if the configured price type cannot be extracted from the quote.\n    fn handle_quote(&mut self, quote: &QuoteTick) -> anyhow::Result<()> {\n        anyhow::bail!(\"`handle_quote_tick` {IMPL_ERR} `{}`\", self.name());\n    }\n\n    fn handle_trade(&mut self, trade: &TradeTick) {\n        panic!(\"`handle_trade_tick` {IMPL_ERR} `{}`\", self.name());\n    }","sourceCodeStart":26,"sourceCodeEnd":62,"githubUrl":"https://github.com/nautechsystems/nautilus_trader/blob/18893faf8b356be3320add8de2f861b0b647cf06/crates/indicators/src/indicator.rs#L26-L62","documentation":"Default `Indicator::handle_depth` panics when an indicator is given an `OrderBookDepth10` snapshot without overriding `handle_depth`. The trait's default body is a guard panic: depth-10 book input requires explicit indicator support, and reaching the default means the indicator was subscribed to depth data it cannot process. The message renders as \"`handle_depth` is not implemented for `<indicator name>`\".","triggerScenarios":"Calling `handle_depth(&OrderBookDepth10)` on an indicator that does not override it — e.g. subscribing a bar- or quote-based indicator to a depth-10 market data stream, or an engine that fans depth snapshots out to all registered indicators.","commonSituations":"Configuring a data client to emit OrderBookDepth10 (depth=10 subscription) while indicators in the pipeline only handle quotes/trades; custom indicators where the depth method was skipped; switching a subscription from deltas to depth without updating indicator code.","solutions":["Override `fn handle_depth(&mut self, depth: &OrderBookDepth10)` in the indicator impl to consume depth snapshots.","Change the market data subscription to a type the indicator supports (quotes, trades, or deltas).","Filter depth events before dispatch so only depth-capable indicators receive them."],"exampleFix":"// before\n// subscription emits OrderBookDepth10 into an indicator without handle_depth\n\n// after\nimpl Indicator for MyIndicator {\n    fn handle_depth(&mut self, depth: &OrderBookDepth10) {\n        // aggregate top-N levels into the indicator's update\n    }\n}","handlingStrategy":"validation","validationCode":"assert!(matches!(ind.data_types(), DataType::Quotes | DataType::Deltas) == false || depth_disabled, \"indicator cannot consume OrderBookDepth10\");","typeGuard":null,"tryCatchPattern":"// guard before dispatch: if depth_capable(ind) { ind.handle_depth(depth); } else { log::warn!(\"skipping depth for {}\", ind.name()); }","preventionTips":["Set the market data subscription depth only when all consumers implement handle_depth.","Filter Depth10 events per subscriber capability in the dispatch layer.","Add an integration test pairing each data client config with the indicator set."],"tags":["rust","panic","indicators","missing-override","order-book-depth"],"backgroundTag":"method-not-implemented","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"}