{"record":{"id":"a214262196fa28be","repo":"nautechsystems/nautilus_trader","slug":"continuous-future-bar-types-request-parameter-mu","errorCode":null,"errorMessage":"Continuous future `bar_types` request parameter must not be empty","messagePattern":"Continuous future `bar_types` request parameter must not be empty","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"crates/data/src/engine/requests.rs","lineNumber":469,"sourceCode":"        let raw = value\n            .as_str()\n            .context(\"`bar_types` request parameter must contain strings\")?;\n        let bar_type =\n            BarType::from_str(raw).context(\"failed to parse `bar_types` request parameter\")?;\n\n        if !bar_type.is_internally_aggregated() {\n            anyhow::bail!(\n                \"Cannot request aggregated bars: {bar_type} must be internally aggregated\"\n            );\n        }\n\n        if !bar_types.contains(&bar_type) {\n            bar_types.push(bar_type);\n        }\n    }\n\n    if bar_types.is_empty() {\n        anyhow::bail!(\"Continuous future `bar_types` request parameter must not be empty\");\n    }\n\n    Ok(bar_types)\n}\n\nfn parse_adjustment_mode(value: Option<&Value>) -> anyhow::Result<ContinuousFutureAdjustmentType> {\n    let Some(value) = value else {\n        return Ok(ContinuousFutureAdjustmentType::default());\n    };\n\n    if let Some(raw) = value.as_str() {\n        return ContinuousFutureAdjustmentType::from_str(raw)\n            .with_context(|| format!(\"failed to parse `{CONTINUOUS_FUTURE_ADJUSTMENT_MODE}`\"));\n    }\n\n    match value.as_u64() {\n        Some(1) => Ok(ContinuousFutureAdjustmentType::BackwardSpread),\n        Some(2) => Ok(ContinuousFutureAdjustmentType::ForwardSpread),","sourceCodeStart":451,"sourceCodeEnd":487,"githubUrl":"https://github.com/nautechsystems/nautilus_trader/blob/18893faf8b356be3320add8de2f861b0b647cf06/crates/data/src/engine/requests.rs#L451-L487","documentation":"The `bar_types` request parameter for a continuous-future request contained no bar types after parsing and deduplication. At least one internally aggregated bar type must be requested to build a continuous series.","triggerScenarios":"Calling continuous_future_request_from_bars with `bar_types` set to an empty array or missing entirely (loop over empty raw array yields empty vec).","commonSituations":"Building request params programmatically where the bar-type list was filtered down to empty; forgetting the `bar_types` key; serializing an empty Vec from config.","solutions":["Add at least one internally aggregated bar type to `bar_types` (e.g. \"ES.C-2025Q1-CME-LAST-DAY\").","Check upstream code that constructs/filters the bar-type list so it cannot yield an empty array.","Assert non-empty before issuing the request."],"exampleFix":"// before\nlet params = json!({\"bar_types\": []});\n// after\nlet params = json!({\"bar_types\": [\"ES.C-2025Q1-CME-LAST-DAY\"]});","handlingStrategy":"validation","validationCode":"assert!(!bar_types.is_empty(), \"bar_types must contain at least one internally aggregated bar type\");","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Default to a single Day bar type when callers do not specify one","Check filtering logic that can empty the list","Validate params before serialization"],"tags":["validation","bars","empty-input"],"backgroundTag":"empty-required-field","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"}