{"record":{"id":"bd247a0ba5043cd3","repo":"nautechsystems/nautilus_trader","slug":"continuous-future-bar-subscriptions-require-an-int","errorCode":null,"errorMessage":"Continuous future bar subscriptions require an internally aggregated target, was {target_bar_type}","messagePattern":"Continuous future bar subscriptions require an internally aggregated target, was (.+?)","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"crates/data/src/engine/mod.rs","lineNumber":5172,"sourceCode":"                    BarAggregatorSubscription::Trade { topic, handler } => {\n                        msgbus::unsubscribe_trades(topic.into(), &handler);\n                    }\n                    BarAggregatorSubscription::Quote { topic, handler } => {\n                        msgbus::unsubscribe_quotes(topic.into(), &handler);\n                    }\n                }\n            }\n        }\n\n        Ok(())\n    }\n\n    fn subscribe_continuous_future_bars(&mut self, cmd: &SubscribeBars) -> anyhow::Result<()> {\n        let target_bar_type = cmd.bar_type;\n        let target_key = target_bar_type.standard();\n\n        if !target_bar_type.is_internally_aggregated() {\n            anyhow::bail!(\n                \"Continuous future bar subscriptions require an internally aggregated target, was {target_bar_type}\"\n            );\n        }\n\n        if self.continuous_future_roller.is_none() {\n            anyhow::bail!(\n                \"Cannot subscribe continuous future bars for {target_bar_type}: roller is not initialized; ensure `register_msgbus_handlers` runs before subscribing\"\n            );\n        }\n\n        let request = continuous_future_subscription_from_bars(cmd)?.ok_or_else(|| {\n            anyhow::anyhow!(\n                \"Continuous future bar subscription requires `continuous_future_transitions`, was {cmd:?}\"\n            )\n        })?;\n\n        self.ensure_continuous_future_target_instrument(&request);\n","sourceCodeStart":5154,"sourceCodeEnd":5190,"githubUrl":"https://github.com/nautechsystems/nautilus_trader/blob/18893faf8b356be3320add8de2f861b0b647cf06/crates/data/src/engine/mod.rs#L5154-L5190","documentation":"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.","triggerScenarios":"Calling subscribe_continuous_future_bars with a SubscribeBars command whose bar_type.has AggregationSource::External (is_internally_aggregated() == false).","commonSituations":"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.","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."],"exampleFix":"// before\nlet bar_type = BarType::from_str(\"ES.cont.5.MINUTE-LAST:external\")?;\n// after\nlet bar_type = BarType::from_str(\"ES.cont.5.MINUTE-LAST\")?; // internal aggregation","handlingStrategy":"validation","validationCode":"if !target_bar_type.is_internally_aggregated() {\n    anyhow::bail!(\"fix bar type before calling subscribe_continuous_future_bars\");\n}","typeGuard":"fn is_valid_continuous_future_target(bt: &BarType) -> bool {\n    bt.is_internally_aggregated()\n}","tryCatchPattern":"if let Err(e) = engine.subscribe_continuous_future_bars(&cmd) {\n    if e.to_string().contains(\"internally aggregated target\") {\n        let fixed = SubscribeBars { bar_type: cmd.bar_type.standard_internally_aggregated(), ..cmd };\n        engine.subscribe_continuous_future_bars(&fixed)?;\n    } else { return Err(e); }\n}","preventionTips":["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"],"tags":["rust","data-engine","futures","bars"],"backgroundTag":"invalid-argument-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"}