{"record":{"id":"67a74bf1ef13a6f6","repo":"nautechsystems/nautilus_trader","slug":"invalid-publisher-for-record-e-67a74b","errorCode":null,"errorMessage":"Invalid `publisher` for record: {e}","messagePattern":"Invalid `publisher` for record: (.+?)","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"crates/adapters/databento/src/symbology.rs","lineNumber":80,"sourceCode":"}\n\n/// Decodes a Databento record into a Nautilus `InstrumentId`.\n///\n/// # Errors\n///\n/// Returns an error if:\n/// - The publisher cannot be extracted from the record.\n/// - The publisher ID is not found in the venue map.\n/// - The underlying instrument ID mapping fails.\npub fn decode_nautilus_instrument_id(\n    record: &dbn::RecordRef,\n    metadata: &mut MetadataCache,\n    publisher_venue_map: &IndexMap<PublisherId, Venue>,\n    symbol_venue_map: &AHashMap<Symbol, Venue>,\n) -> anyhow::Result<InstrumentId> {\n    let publisher = record\n        .publisher()\n        .map_err(|e| anyhow::anyhow!(\"Invalid `publisher` for record: {e}\"))?;\n    let publisher_id = publisher as PublisherId;\n    let venue = publisher_venue_map\n        .get(&publisher_id)\n        .ok_or_else(|| anyhow::anyhow!(\"`Venue` not found for `publisher_id` {publisher_id}\"))?;\n    let mut instrument_id = get_nautilus_instrument_id_for_record(record, metadata, *venue)?;\n\n    if publisher == Publisher::GlbxMdp3Glbx\n        && let Some(venue) = symbol_venue_map.get(&instrument_id.symbol)\n    {\n        instrument_id.venue = *venue;\n    }\n\n    Ok(instrument_id)\n}\n\n/// Gets the Nautilus `InstrumentId` for a Databento record.\n///\n/// # Errors","sourceCodeStart":62,"sourceCodeEnd":98,"githubUrl":"https://github.com/nautechsystems/nautilus_trader/blob/18893faf8b356be3320add8de2f861b0b647cf06/crates/adapters/databento/src/symbology.rs#L62-L98","documentation":"decode_nautilus_instrument_id first reads the record's publisher via DBN's record.publisher(). If the publisher field cannot be interpreted as a valid DBN Publisher enum (RChunk decode error), the record's venue cannot be derived and this error is returned. It guards against corrupt or newer-protocol records the installed dbn crate cannot decode.","triggerScenarios":"Decoding a DBN record whose publisher_id is not a value known to the installed `dbn` crate version — e.g. Databento added a new publisher/dataset and the local crate is outdated, or the record bytes are truncated/corrupt so the enum deserialization fails.","commonSituations":"Using an old nautilus/databento adapter with data files generated by a newer DBN schema version; mixing schemas (e.g. reading a v2 record as v3); corrupt downloaded zst/dbn files.","solutions":["Upgrade the `dbn` crate / nautilus databento adapter to a version that knows the publisher in the data file.","Re-download the data so the file matches a supported DBN schema version.","Check the file for truncation/corruption (size mismatch, failed decompression) and re-fetch.","Pin the data schema version explicitly when requesting from Databento so it matches the decoder."],"exampleFix":"// Cargo.toml\n// before\ndbn = \"0.22\"\n// after\ndbn = \"0.29\"  # supports the publisher in your data","handlingStrategy":"try-catch","validationCode":"// Rust\nlet publisher = record.publisher();\nanyhow::ensure!(publisher.is_ok(), \"record publisher not decodable by installed dbn version\");","typeGuard":null,"tryCatchPattern":"match decode_nautilus_instrument_id(record, metadata, &pub_map, &sym_map) {\n    Ok(id) => id,\n    Err(e) if e.to_string().contains(\"Invalid `publisher`\") => {\n        log::warn!(\"skipping record with undecodable publisher: {e}\");\n        return Ok(None); // skip record\n    }\n    Err(e) => return Err(e.into()),\n}","preventionTips":["Keep the dbn crate and adapter in lockstep with the DBN schema version of your data","Validate downloaded files (checksum/size) before decoding","Pin a schema_version in Databento requests"],"tags":["databento","rust","dbn","publisher","decode"],"backgroundTag":"invalid-enum-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"}