{"record":{"id":"33a1169a06b15177","repo":"nautechsystems/nautilus_trader","slug":"continuous-future-target-primary-bar-type-must-b","errorCode":null,"errorMessage":"Continuous future target {primary_bar_type} must be internally aggregated","messagePattern":"Continuous future target (.+?) must be internally aggregated","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"crates/data/src/engine/requests.rs","lineNumber":372,"sourceCode":"        return Ok(None);\n    }\n\n    if params.contains_key(BAR_TYPES) {\n        anyhow::bail!(\n            \"Continuous future bar subscriptions must not include `bar_types`; pass the chain in continuous_future_transitions instead\"\n        );\n    }\n\n    parse_continuous_future(vec![cmd.bar_type], params).map(Some)\n}\n\nfn parse_continuous_future(\n    bar_types: Vec<BarType>,\n    params: &Params,\n) -> anyhow::Result<ContinuousFutureRequest> {\n    let primary_bar_type = bar_types[0];\n    if !primary_bar_type.is_internally_aggregated() {\n        anyhow::bail!(\"Continuous future target {primary_bar_type} must be internally aggregated\");\n    }\n\n    let transitions_value = params\n        .get(CONTINUOUS_FUTURE_TRANSITIONS)\n        .context(\"missing `continuous_future_transitions`\")?;\n    let adjustment_mode = parse_adjustment_mode(params.get(CONTINUOUS_FUTURE_ADJUSTMENT_MODE))\n        .with_context(|| {\n            format!(\"Invalid continuous future adjustment mode for {primary_bar_type}\")\n        })?;\n    let first_pre_instrument_id = parse_optional_chain_bound(\n        params,\n        FIRST_PRE_INSTRUMENT_ID,\n        primary_bar_type.instrument_id(),\n    )?;\n    let last_post_instrument_id = parse_optional_chain_bound(\n        params,\n        LAST_POST_INSTRUMENT_ID,\n        primary_bar_type.instrument_id(),","sourceCodeStart":354,"sourceCodeEnd":390,"githubUrl":"https://github.com/nautechsystems/nautilus_trader/blob/18893faf8b356be3320add8de2f861b0b647cf06/crates/data/src/engine/requests.rs#L354-L390","documentation":"The primary bar type of a continuous future request/subscription must be internally aggregated, since the engine builds the continuous series from its own aggregated bars. Externally aggregated targets cannot be stitched or adjusted by the roller, so parse_continuous_future rejects them.","triggerScenarios":"Calling subscribe_continuous_future_bars or a continuous future bars request where bar_types[0] has AggregationSource::External (is_internally_aggregated() == false).","commonSituations":"Bar type strings parsed with an external-aggregation suffix; adapters that emit pre-aggregated bars being reused for continuous futures; refactors that changed the aggregation source default.","solutions":["Construct the primary bar type with internal aggregation (omit the ':external' suffix or pass AggregationSource::Internal explicitly).","Verify primary_bar_type.is_internally_aggregated() before invoking the continuous future API.","If external bars are required, aggregate internally or bypass the continuous future pipeline."],"exampleFix":"// before\nlet primary = BarType::new(id, spec, AggregationSource::External);\nparse_continuous_future(vec![primary], &params)?;\n// after\nlet primary = BarType::new(id, spec, AggregationSource::Internal);\nparse_continuous_future(vec![primary], &params)?;","handlingStrategy":"validation","validationCode":"if !primary_bar_type.is_internally_aggregated() {\n    anyhow::bail!(\"continuous future primary must be internally aggregated\");\n}","typeGuard":"fn is_valid_continuous_primary(bt: &BarType) -> bool {\n    bt.is_internally_aggregated()\n}","tryCatchPattern":"match parse_continuous_future(bar_types, &params) {\n    Err(e) if e.to_string().contains(\"must be internally aggregated\") => {\n        let bt = BarType::new(bar_types[0].instrument_id().clone(), bar_types[0].spec(), AggregationSource::Internal);\n        parse_continuous_future(vec![bt], &params)?;\n    }\n    r => r,\n}","preventionTips":["Build continuous future primary bar types without an external aggregation source","Unit-test that parsed bar type strings for continuous futures use internal aggregation","Document in param builders that continuous futures require internal aggregation"],"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-14T05:17:10.506Z"}