nautechsystems/nautilus_trader · critical
`handle_bar` is not implemented for `{}`
Error message
`handle_bar` is not implemented for `{}` What it means
Default `Indicator::handle_bar` panics when an indicator receives a `Bar` without overriding `handle_bar`. The default body is a guard panic rendering "`handle_bar` is not implemented for `<indicator name>`". Bars are an aggregated data type; an indicator must explicitly opt into bar input, so reaching the default indicates the indicator was handed data it does not support.
Source
Thrown at crates/indicators/src/indicator.rs:65
fn handle_book(&mut self, book: &OrderBook) {
panic!("`handle_book_mbo` {IMPL_ERR} `{}`", self.name());
}
/// Updates the indicator with the given quote tick.
///
/// # Errors
///
/// Returns an error if the configured price type cannot be extracted from the quote.
fn handle_quote(&mut self, quote: &QuoteTick) -> anyhow::Result<()> {
anyhow::bail!("`handle_quote_tick` {IMPL_ERR} `{}`", self.name());
}
fn handle_trade(&mut self, trade: &TradeTick) {
panic!("`handle_trade_tick` {IMPL_ERR} `{}`", self.name());
}
fn handle_bar(&mut self, bar: &Bar) {
panic!("`handle_bar` {IMPL_ERR} `{}`", self.name());
}
fn reset(&mut self);
}
pub trait MovingAverage: Indicator {
fn value(&self) -> f64;
fn count(&self) -> usize;
fn update_raw(&mut self, value: f64);
}
impl Debug for dyn Indicator + Send {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
// Implement custom formatting for the Indicator trait object
write!(f, "Indicator {{ ... }}")
}
}
View on GitHub (pinned to 18893faf8b)
Solutions
- Override `fn handle_bar(&mut self, bar: &Bar)` in the indicator impl to update from bar open/high/low/close.
- Feed the indicator raw ticks instead of bars, or select an indicator variant that supports bars.
- Adjust subscriptions so only bar-capable indicators receive Bar events.
Example fix
// before
impl Indicator for TickOnlyIndicator { /* no handle_bar */ }
// after
impl Indicator for TickOnlyIndicator {
fn handle_bar(&mut self, bar: &Bar) {
self.update_from_price(bar.close());
}
} Defensive patterns
Strategy: validation
Validate before calling
assert!(ind.accepts(DataType::Bar), "{} has no handle_bar impl", ind.name()); Try / catch
// guard: if bar_capable(ind) { ind.handle_bar(bar); } else { log::debug!("{} skips bars", ind.name()); } Prevention
- When switching a strategy between tick and bar data, swap the indicator set accordingly.
- Do not broadcast finished bars to every indicator; dispatch only to bar-capable ones.
- Add a smoke test that runs the aggregator + indicators end to end.
When it happens
Trigger: Calling `handle_bar(&Bar)` on a tick-based indicator (one implementing handle_quote/handle_trade but not handle_bar) — e.g. aggregating ticks into bars and then pushing the bars into all indicators, or a bar-based strategy using an indicator that only processes ticks.
Common situations: Switching a strategy from tick data to bar data without swapping indicators; bar aggregation pipelines dispatching finished bars to every registered indicator; custom indicators forgetting the bar override.
Related errors
- `handle_delta` {IMPL_ERR} `{}`
- `handle_deltas` {IMPL_ERR} `{}`
- `handle_depth` {IMPL_ERR} `{}`
- `handle_book_mbo` {IMPL_ERR} `{}`
- `handle_trade_tick` is not implemented for `{}`
AI-assisted analysis of nautechsystems/nautilus_trader@18893faf8b (2026-09-08).
Data as JSON: /api/errors/445ca445a7f49c24.
Report an issue: GitHub.