{"record":{"id":"5557ed58c3025755","repo":"nautechsystems/nautilus_trader","slug":"could-not-resolve-price-precision-for-instrumen","errorCode":null,"errorMessage":"Could not resolve `price_precision` for {instrument_id}: pass `price_precision` explicitly, call `set_price_precision`, or fetch the instrument definitions first via `get_range_instruments`","messagePattern":"Could not resolve `price_precision` for (.+?): pass `price_precision` explicitly, call `set_price_precision`, or fetch the instrument definitions first via `get_range_instruments`","errorType":"exception","errorClass":"anyhow::Error","httpStatus":null,"severity":"error","filePath":"crates/adapters/databento/src/historical.rs","lineNumber":221,"sourceCode":"    ///\n    /// # Errors\n    ///\n    /// Returns an error when no precision is available.\n    fn resolve_price_precision(\n        &self,\n        instrument_id: &InstrumentId,\n        price_precision: Option<u8>,\n    ) -> anyhow::Result<u8> {\n        if let Some(precision) = price_precision {\n            return Ok(precision);\n        }\n\n        let precisions = self.price_precisions.load();\n        precisions\n            .get(&instrument_id.symbol)\n            .copied()\n            .ok_or_else(|| {\n                anyhow::anyhow!(\n                    \"Could not resolve `price_precision` for {instrument_id}: \\\n                     pass `price_precision` explicitly, call `set_price_precision`, \\\n                     or fetch the instrument definitions first via `get_range_instruments`\"\n                )\n            })\n    }\n\n    fn resolve_cached_price_precision(\n        &self,\n        instrument_id: &InstrumentId,\n        price_precision: Option<u8>,\n        precision_cache: &mut AHashMap<InstrumentId, u8>,\n    ) -> anyhow::Result<u8> {\n        if let Some(precision) = price_precision {\n            return Ok(precision);\n        }\n\n        if let Some(precision) = precision_cache.get(instrument_id) {","sourceCodeStart":203,"sourceCodeEnd":239,"githubUrl":"https://github.com/nautechsystems/nautilus_trader/blob/18893faf8b356be3320add8de2f861b0b647cf06/crates/adapters/databento/src/historical.rs#L203-L239","documentation":"The Databento historical adapter needs `price_precision` to decode instrument definitions, and it resolves it from an explicit argument, a previously cached value, or data seeded via `get_range_instruments`. If none is available for the given InstrumentId it raises this error rather than guessing. It is an API-misuse / ordering error, not a network failure.","triggerScenarios":"Calling an adapter method (e.g. one that decodes definitions) that internally calls `resolve_price_precision` when: no `price_precision` argument was passed, `set_price_precision` was never called for the symbol, and `get_range_instruments` was not run first to seed the cache.","commonSituations":"Querying raw historical records for a symbol never seen before; calling decode paths before instrument definitions were fetched; cache cleared or a new client instance constructed.","solutions":["Pass `price_precision` explicitly to the call","Call `set_price_precision(instrument_id, precision)` before decoding","Call `get_range_instruments` once first to seed the precision cache from instrument definitions","Verify the symbol spelling matches what was cached (symbol key match is exact)"],"exampleFix":"// before\nlet records = client.get_range_raw(params).await?;\n// after\nclient.set_price_precision(instrument_id, 2);\nlet records = client.get_range_raw(params).await?;","handlingStrategy":"validation","validationCode":"if client.resolve_price_precision(instrument_id, None).is_err() {\n    client.seed_price_precision_if_needed(&params).await?; // fetch instrument definitions first\n}","typeGuard":"fn precision_available(cache: &DashMap<String, u8>, symbol: &str) -> bool { cache.contains_key(symbol) }","tryCatchPattern":"let precision = args.price_precision\n    .or_else(|| client.get_cached_price_precision(&instrument_id))\n    .ok_or_else(|| anyhow!(\"price_precision required for {instrument_id}; fetch instruments first\"))?;","preventionTips":["Always pass price_precision explicitly when you know it","Call get_range_instruments once at startup to seed precisions for all symbols you will use","Call set_price_precision after decoding each new instrument","Keep symbol spelling consistent between caching and lookup"],"tags":["rust","databento","price-precision","missing-argument"],"backgroundTag":"missing-required-argument","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"}