{"record":{"id":"303d7bc88e1fe8b0","repo":"nautechsystems/nautilus_trader","slug":"cannot-resolve-raw-symbol-for-instrument-id-raw-i","errorCode":null,"errorMessage":"Cannot resolve raw_symbol for instrument_id {raw_instrument_id}","messagePattern":"Cannot resolve raw_symbol for instrument_id (.+?)","errorType":"exception","errorClass":"anyhow::Error","httpStatus":null,"severity":"error","filePath":"crates/adapters/databento/src/live.rs","lineNumber":1076,"sourceCode":"        });\n\n    if let Some(price_precision) = price_precision {\n        subscription_price_precision_map.insert(msg.hd.instrument_id, price_precision);\n    }\n\n    Ok(())\n}\n\n/// Updates the instrument ID map using exchange information from the symbol map.\nfn update_instrument_id_map_with_exchange(\n    symbol_map: &PitSymbolMap,\n    symbol_venue_map: &AtomicMap<Symbol, Venue>,\n    instrument_id_map: &mut AHashMap<u32, InstrumentId>,\n    raw_instrument_id: u32,\n    exchange: &str,\n) -> anyhow::Result<InstrumentId> {\n    let raw_symbol = symbol_map.get(raw_instrument_id).ok_or_else(|| {\n        anyhow::anyhow!(\"Cannot resolve raw_symbol for instrument_id {raw_instrument_id}\")\n    })?;\n    let symbol = Symbol::from(raw_symbol.as_str());\n    let venue = Venue::from_code(exchange)\n        .map_err(|e| anyhow::anyhow!(\"Invalid venue code '{exchange}': {e}\"))?;\n    let instrument_id = InstrumentId::new(symbol, venue);\n    symbol_venue_map.rcu(|m| {\n        m.entry(symbol).or_insert(venue);\n    });\n    instrument_id_map.insert(raw_instrument_id, instrument_id);\n    Ok(instrument_id)\n}\n\nfn update_instrument_id_map(\n    record: &dbn::RecordRef,\n    symbol_map: &PitSymbolMap,\n    publisher_venue_map: &IndexMap<PublisherId, Venue>,\n    symbol_venue_map: &AtomicMap<Symbol, Venue>,\n    instrument_id_map: &mut AHashMap<u32, InstrumentId>,","sourceCodeStart":1058,"sourceCodeEnd":1094,"githubUrl":"https://github.com/nautechsystems/nautilus_trader/blob/18893faf8b356be3320add8de2f861b0b647cf06/crates/adapters/databento/src/live.rs#L1058-L1094","documentation":"When translating a Databento numeric instrument_id to a Nautilus InstrumentId using an exchange string, the point-in-time symbol map has no raw symbol registered for that numeric ID. Without a raw symbol the adapter cannot construct a valid instrument identifier.","triggerScenarios":"`update_instrument_id_map_with_exchange` is invoked from run_session with a raw_instrument_id that was never inserted into the PitSymbolMap — e.g. records arrive before the corresponding symbol-mapping/definition data populated the map.","commonSituations":"Subscribing to schemas that emit records for instruments not covered by loaded definitions, starting the stream before symbol map initialization completes, or a publisher whose symbol mappings arrive late.","solutions":["Load instrument definitions first (load_instruments / definition schema) so the symbol map is populated before other record types","Subscribe to the symbol mapping schema so PitSymbolMap gets filled for the instruments in the stream","Check for records arriving out of order; add retry/requeue logic so the record is reprocessed once the symbol map is populated","Verify the instrument_id actually belongs to your subscription universe; filter unexpected IDs before processing"],"exampleFix":"// before: hard failure on first unseen instrument_id\nlet raw_symbol = symbol_map.get(raw_instrument_id).ok_or_else(|| {\n    anyhow::anyhow!(\"Cannot resolve raw_symbol for instrument_id {raw_instrument_id}\")\n})?;\n// after: skip and warn until the mapping arrives\nlet raw_symbol = match symbol_map.get(raw_instrument_id) {\n    Some(s) => s,\n    None => {\n        log::warn!(\"raw_symbol not yet mapped for {raw_instrument_id}; skipping record\");\n        return Ok(instrument_id_placeholder);\n    }\n};","handlingStrategy":"validation","validationCode":"// before streaming, ensure the symbol map knows your instruments\nlet mapped = symbol_map.get(raw_instrument_id);\nassert!(mapped.is_some(), \"call load_instruments / subscribe symbol mapping first\");","typeGuard":null,"tryCatchPattern":"match update_instrument_id_map_with_exchange(...) {\n    Ok(id) => id,\n    Err(e) if e.to_string().contains(\"Cannot resolve raw_symbol\") => {\n        log::warn!(\"mapping not ready: {e}\"); /* requeue record */\n    }\n    Err(e) => return Err(e),\n}","preventionTips":["Load instrument definitions before consuming live data records","Subscribe to the symbol mapping schema","Don't start streaming before map initialization completes"],"tags":["databento","symbol-mapping","lookup-miss","live-stream"],"backgroundTag":"record-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"}