{"record":{"id":"774aaa6bc7fc9477","repo":"nautechsystems/nautilus_trader","slug":"cannot-resolve-raw-symbol-from-symbol-map-for","errorCode":null,"errorMessage":"Cannot resolve `raw_symbol` from `symbol_map` for instrument_id {header.instrument_id}","messagePattern":"Cannot resolve `raw_symbol` from `symbol_map` for instrument_id (.+?)","errorType":"exception","errorClass":"anyhow::Error","httpStatus":null,"severity":"error","filePath":"crates/adapters/databento/src/live.rs","lineNumber":1104,"sourceCode":"    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>,\n) -> anyhow::Result<InstrumentId> {\n    let header = record.header();\n\n    // Check if instrument ID is already in the map\n    if let Some(&instrument_id) = instrument_id_map.get(&header.instrument_id) {\n        return Ok(instrument_id);\n    }\n\n    let raw_symbol = symbol_map.get_for_rec(record).ok_or_else(|| {\n        anyhow::anyhow!(\n            \"Cannot resolve `raw_symbol` from `symbol_map` for instrument_id {}\",\n            header.instrument_id\n        )\n    })?;\n\n    let symbol = Symbol::from_str_unchecked(raw_symbol);\n\n    let publisher_id = header.publisher_id;\n    let venue = if let Some(venue) = symbol_venue_map.get_cloned(&symbol) {\n        venue\n    } else {\n        let venue = publisher_venue_map\n            .get(&publisher_id)\n            .ok_or_else(|| anyhow::anyhow!(\"No venue found for `publisher_id` {publisher_id}\"))?;\n        *venue\n    };\n    let instrument_id = InstrumentId::new(symbol, venue);\n","sourceCodeStart":1086,"sourceCodeEnd":1122,"githubUrl":"https://github.com/nautechsystems/nautilus_trader/blob/18893faf8b356be3320add8de2f861b0b647cf06/crates/adapters/databento/src/live.rs#L1086-L1122","documentation":"For any incoming Databento record whose numeric instrument_id is not yet in the cached map, the adapter resolves the raw symbol from the point-in-time symbol map. This error means the map contains no symbol for the record's instrument_id, so a Nautilus InstrumentId cannot be constructed.","triggerScenarios":"Records (instrument defs, status, imbalance, statistics, or general data) arrive in run_session / handle_record for an instrument_id that has no entry in PitSymbolMap — typically because symbol mapping messages or instrument definitions were not loaded/subscribed before these records.","commonSituations":"Subscribing to a schema without also subscribing to symbol mappings, missing dataset coverage for an instrument, stream started mid-session where earlier mapping messages were missed.","solutions":["Subscribe to the Databento symbol mapping schema alongside your data schemas so PitSymbolMap is populated","Call load_instruments (definition schema) before streaming other record types","Order your subscriptions so symbol-mapping data arrives before status/statistics/imbalance records","Add a log-and-skip policy for unmapped instrument_ids instead of failing the whole session"],"exampleFix":"// before\nlet raw_symbol = symbol_map.get_for_rec(record).ok_or_else(|| {\n    anyhow::anyhow!(\n        \"Cannot resolve `raw_symbol` from `symbol_map` for instrument_id {}\",\n        header.instrument_id\n    )\n})?;\n// after\nlet raw_symbol = match symbol_map.get_for_rec(record) {\n    Some(s) => s,\n    None => {\n        log::warn!(\"No symbol mapping yet for instrument_id {}\", header.instrument_id);\n        return Ok(InstrumentId::default());\n    }\n};","handlingStrategy":"try-catch","validationCode":"// ensure the symbol map is populated before consuming records\nif symbol_map.get_for_rec(&probe_record).is_none() {\n    return Err(anyhow::anyhow!(\"symbol map not initialized; load definitions first\"));\n}","typeGuard":null,"tryCatchPattern":"match update_instrument_id_map(...) {\n    Ok(id) => id,\n    Err(e) if e.to_string().contains(\"Cannot resolve `raw_symbol`\") => {\n        log::warn!(\"unmapped instrument_id, skipping record\");\n    }\n    Err(e) => return Err(e),\n}","preventionTips":["Always subscribe to symbol mapping alongside data schemas","Call load_instruments before streaming status/statistics/imbalance data","Log-and-skip unmapped IDs instead of aborting the session"],"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-14T05:17:10.506Z"}