{"record":{"id":"6f268f6270b7d9dc","repo":"nautechsystems/nautilus_trader","slug":"price-precisions-length-must-match-instrum","errorCode":null,"errorMessage":"`price_precisions` length ({}) must match `instrument_ids` length ({})","messagePattern":"`price_precisions` length \\((.+?)\\) must match `instrument_ids` length \\((.+?)\\)","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"crates/adapters/databento/src/live.rs","lineNumber":191,"sourceCode":"    ///\n    /// # Errors\n    ///\n    /// Returns an error if symbology, schema, timestamp, or precision inputs are invalid,\n    /// or if the command cannot be sent to the feed handler.\n    #[expect(clippy::needless_pass_by_value)]\n    pub fn subscribe(\n        &mut self,\n        schema: String,\n        instrument_ids: Vec<InstrumentId>,\n        start: Option<u64>,\n        snapshot: Option<bool>,\n        price_precisions: Option<Vec<Option<u8>>>,\n        stype_in: Option<String>,\n    ) -> anyhow::Result<()> {\n        if let Some(precisions) = &price_precisions\n            && precisions.len() != instrument_ids.len()\n        {\n            anyhow::bail!(\n                \"`price_precisions` length ({}) must match `instrument_ids` length ({})\",\n                precisions.len(),\n                instrument_ids.len()\n            );\n        }\n\n        let symbols: Vec<String> = instrument_ids\n            .iter()\n            .map(|id| id.symbol.to_string())\n            .collect();\n        let first_symbol = symbols\n            .first()\n            .ok_or_else(|| anyhow::anyhow!(\"No symbols provided\"))?;\n        let stype_in = match stype_in {\n            Some(stype_in) => dbn::SType::from_str(&stype_in)?,\n            None => infer_symbology_type(first_symbol),\n        };\n        let symbols: Vec<&str> = symbols.iter().map(String::as_str).collect();","sourceCodeStart":173,"sourceCodeEnd":209,"githubUrl":"https://github.com/nautechsystems/nautilus_trader/blob/18893faf8b356be3320add8de2f861b0b647cf06/crates/adapters/databento/src/live.rs#L173-L209","documentation":"The live Databento client's `subscribe` accepts an optional `price_precisions` list that must be parallel to `instrument_ids` (one precision per instrument, entries may be None). When the list is provided but its length differs from the instrument list, the client bails before subscribing.","triggerScenarios":"Calling `subscribe` (directly or via `py_subscribe`) with `instrument_ids` of length N and `price_precisions` = Some(vec) of length != N, including passing an empty precision list with non-empty instruments.","commonSituations":"Building the precision list in Python from a different collection than the instrument IDs; filtering instruments but forgetting to filter precisions; passing price_precisions=[] thinking it means 'use defaults'.","solutions":["Make `price_precisions` exactly the same length as `instrument_ids`, using None entries for defaults.","Pass `price_precisions=None` if you don't need per-instrument precisions.","In Python, zip or derive precisions from the same source as the instrument IDs.","Assert lengths match before calling subscribe."],"exampleFix":"// before\nprecisions = [8, 4]  # 2 entries\nawait client.subscribe(instrument_ids, price_precisions=precisions)  # 3 instruments\n// after\nprecisions = [8, None, 4]  # one entry (or None) per instrument\nawait client.subscribe(instrument_ids, price_precisions=precisions)","handlingStrategy":"validation","validationCode":"if price_precisions is not None:\n    assert len(price_precisions) == len(instrument_ids), (\n        f\"price_precisions ({len(price_precisions)}) must match instrument_ids ({len(instrument_ids)})\")","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Build precisions from the same collection as instrument IDs (zip/derive, not parallel literals)","Prefer price_precisions=None and let the client infer precisions","Filter instruments and precisions together in one operation"],"tags":["databento","subscription","argument-validation","length-mismatch"],"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"}