{"record":{"id":"a174a46dd6e25241","repo":"nautechsystems/nautilus_trader","slug":"openpositions-instrument-not-in-cache-for-pair","errorCode":null,"errorMessage":"OpenPositions: instrument not in cache for pair {}","messagePattern":"OpenPositions: instrument not in cache for pair (.+?)","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"crates/adapters/kraken/src/http/spot/client.rs","lineNumber":2406,"sourceCode":"                && pair.as_str() != pos.pair\n            {\n                continue;\n            }\n\n            if let Some(status) = pos.posstatus.as_deref()\n                && status != \"open\"\n            {\n                log::debug!(\n                    \"Skipping non-open OpenPositions entry for {}: posstatus={status}\",\n                    pos.pair,\n                );\n                continue;\n            }\n\n            let instrument = self\n                .get_instrument_by_raw_symbol(pos.pair.as_str())\n                .ok_or_else(|| {\n                    anyhow::anyhow!(\n                        \"OpenPositions: instrument not in cache for pair {}\",\n                        pos.pair\n                    )\n                })?;\n\n            let vol = Decimal::from_str_exact(&pos.vol)\n                .with_context(|| format!(\"OpenPositions: failed to parse vol for {}\", pos.pair))?;\n            let vol_closed = Decimal::from_str_exact(&pos.vol_closed).with_context(|| {\n                format!(\"OpenPositions: failed to parse vol_closed for {}\", pos.pair)\n            })?;\n\n            let lot_net = (vol - vol_closed).max(Decimal::ZERO);\n            let signed_lot = match pos.side {\n                KrakenOrderSide::Buy => lot_net,\n                KrakenOrderSide::Sell => -lot_net,\n            };\n\n            let entry = agg","sourceCodeStart":2388,"sourceCodeEnd":2424,"githubUrl":"https://github.com/nautechsystems/nautilus_trader/blob/18893faf8b356be3320add8de2f861b0b647cf06/crates/adapters/kraken/src/http/spot/client.rs#L2388-L2424","documentation":"When parsing Kraken's OpenPositions response into `PositionStatusReport`s, each position's raw pair string (e.g. \"XBTUSD\") must be mapped to a cached Nautilus instrument. If `get_instrument_by_raw_symbol` returns `None`, the adapter cannot determine precision/side metadata and fails with this error. It indicates the local instrument cache does not contain the venue pair returned by Kraken.","triggerScenarios":"Calling the OpenPositions request when the instrument cache was never initialized (instruments provider not loaded), or Kraken returns a pair not present in the loaded instruments (delisted/new pair, different pair naming, or cache loaded for a filtered subset of pairs).","commonSituations":"Requesting position reports before `initialize`/instrument loading completed; account holds a margin position in a pair excluded from configured instrument filters; Kraken added a new pair not yet in the adapter's cached data.","solutions":["Load/refresh instruments for the account's pairs before calling OpenPositions (initialize the instruments provider).","Remove or close positions on pairs you do not load, or widen instrument load filters to include all traded pairs.","Check the raw pair string in the error and confirm it exists in Kraken's AssetPairs and in your instrument definitions.","Update the adapter/cache data if the pair is new since your cached instruments snapshot."],"exampleFix":null,"handlingStrategy":"validation","validationCode":"fn pair_cached(client: &KrakenSpotHttpClient, pair: &str) -> bool {\n    client.get_instrument_by_raw_symbol(pair).is_some()\n}","typeGuard":null,"tryCatchPattern":"if !pair_cached(&client, \"XBTUSD\") { client.load_instruments_if_needed().await?; }","preventionTips":[],"tags":["instrument-cache","kraken","positions","state"],"backgroundTag":"resource-not-found","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"}