nautechsystems/nautilus_trader · error
Continuous future bar subscriptions require an internally ag
Error message
Continuous future bar subscriptions require an internally aggregated target, was {target_bar_type} What it means
Continuous future bars (root-symbol chains stitched across contract expiries via a continuous_future roller) are computed by the DataEngine from internally aggregated bars. If the target BarType is externally aggregated there is no internal aggregation pipeline to hook the continuous roll adjustment into, so the engine refuses the subscription.
Source
Thrown at crates/data/src/engine/mod.rs:5172
BarAggregatorSubscription::Trade { topic, handler } => {
msgbus::unsubscribe_trades(topic.into(), &handler);
}
BarAggregatorSubscription::Quote { topic, handler } => {
msgbus::unsubscribe_quotes(topic.into(), &handler);
}
}
}
}
Ok(())
}
fn subscribe_continuous_future_bars(&mut self, cmd: &SubscribeBars) -> anyhow::Result<()> {
let target_bar_type = cmd.bar_type;
let target_key = target_bar_type.standard();
if !target_bar_type.is_internally_aggregated() {
anyhow::bail!(
"Continuous future bar subscriptions require an internally aggregated target, was {target_bar_type}"
);
}
if self.continuous_future_roller.is_none() {
anyhow::bail!(
"Cannot subscribe continuous future bars for {target_bar_type}: roller is not initialized; ensure `register_msgbus_handlers` runs before subscribing"
);
}
let request = continuous_future_subscription_from_bars(cmd)?.ok_or_else(|| {
anyhow::anyhow!(
"Continuous future bar subscription requires `continuous_future_transitions`, was {cmd:?}"
)
})?;
self.ensure_continuous_future_target_instrument(&request);
View on GitHub (pinned to 18893faf8b)
Solutions
- Change the BarType to use internal aggregation (default when built from spec without an explicit external source).
- If bars must come from an external source, aggregate them internally first or subscribe without the continuous-future path.
- Verify with bar_type.is_internally_aggregated() before calling the continuous future subscription.
Example fix
// before
let bar_type = BarType::from_str("ES.cont.5.MINUTE-LAST:external")?;
// after
let bar_type = BarType::from_str("ES.cont.5.MINUTE-LAST")?; // internal aggregation Defensive patterns
Strategy: validation
Validate before calling
if !target_bar_type.is_internally_aggregated() {
anyhow::bail!("fix bar type before calling subscribe_continuous_future_bars");
} Type guard
fn is_valid_continuous_future_target(bt: &BarType) -> bool {
bt.is_internally_aggregated()
} Try / catch
if let Err(e) = engine.subscribe_continuous_future_bars(&cmd) {
if e.to_string().contains("internally aggregated target") {
let fixed = SubscribeBars { bar_type: cmd.bar_type.standard_internally_aggregated(), ..cmd };
engine.subscribe_continuous_future_bars(&fixed)?;
} else { return Err(e); }
} Prevention
- Use default (internal) aggregation for continuous future bar types
- Assert is_internally_aggregated() in tests covering continuous future subscriptions
- Avoid global configs that force external aggregation on all bar types
When it happens
Trigger: Calling subscribe_continuous_future_bars with a SubscribeBars command whose bar_type.has AggregationSource::External (is_internally_aggregated() == false).
Common situations: Parsing a bar type string with an external-aggregation suffix; forwarding a subscription intended for a normal externally-fed bar into the continuous future path; older configs where bars were fed by an adapter.
Understand the failure class
Background: "Must be a positive integer", "Invalid value", "Unsupported": the invalid-argument-value error family, when a library rejects the value you pass — this error's family across 35 libraries.
Related errors
- Continuous future target {primary_bar_type} must be internal
- Cannot subscribe for externally aggregated synthetic instrum
- Cannot subscribe continuous future bars for {target_bar_type
- No continuous future subscription state for {target_bar_type
- Cannot request aggregated bars: {bar_type} must be internall
AI-assisted analysis of nautechsystems/nautilus_trader@18893faf8b (2026-09-08).
Data as JSON: /api/errors/bd247a0ba5043cd3.
Report an issue: GitHub.