nautechsystems/nautilus_trader · error

Invalid `publisher` for record: {e}

Error message

Invalid `publisher` for record: {e}

What it means

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.

Source

Thrown at crates/adapters/databento/src/symbology.rs:80

}

/// Decodes a Databento record into a Nautilus `InstrumentId`.
///
/// # Errors
///
/// Returns an error if:
/// - The publisher cannot be extracted from the record.
/// - The publisher ID is not found in the venue map.
/// - The underlying instrument ID mapping fails.
pub fn decode_nautilus_instrument_id(
    record: &dbn::RecordRef,
    metadata: &mut MetadataCache,
    publisher_venue_map: &IndexMap<PublisherId, Venue>,
    symbol_venue_map: &AHashMap<Symbol, Venue>,
) -> anyhow::Result<InstrumentId> {
    let publisher = record
        .publisher()
        .map_err(|e| anyhow::anyhow!("Invalid `publisher` for record: {e}"))?;
    let publisher_id = publisher as PublisherId;
    let venue = publisher_venue_map
        .get(&publisher_id)
        .ok_or_else(|| anyhow::anyhow!("`Venue` not found for `publisher_id` {publisher_id}"))?;
    let mut instrument_id = get_nautilus_instrument_id_for_record(record, metadata, *venue)?;

    if publisher == Publisher::GlbxMdp3Glbx
        && let Some(venue) = symbol_venue_map.get(&instrument_id.symbol)
    {
        instrument_id.venue = *venue;
    }

    Ok(instrument_id)
}

/// Gets the Nautilus `InstrumentId` for a Databento record.
///
/// # Errors

View on GitHub (pinned to 18893faf8b)

Solutions

  1. Upgrade the `dbn` crate / nautilus databento adapter to a version that knows the publisher in the data file.
  2. Re-download the data so the file matches a supported DBN schema version.
  3. Check the file for truncation/corruption (size mismatch, failed decompression) and re-fetch.
  4. Pin the data schema version explicitly when requesting from Databento so it matches the decoder.

Example fix

// Cargo.toml
// before
dbn = "0.22"
// after
dbn = "0.29"  # supports the publisher in your data
Defensive patterns

Strategy: try-catch

Validate before calling

// Rust
let publisher = record.publisher();
anyhow::ensure!(publisher.is_ok(), "record publisher not decodable by installed dbn version");

Try / catch

match decode_nautilus_instrument_id(record, metadata, &pub_map, &sym_map) {
    Ok(id) => id,
    Err(e) if e.to_string().contains("Invalid `publisher`") => {
        log::warn!("skipping record with undecodable publisher: {e}");
        return Ok(None); // skip record
    }
    Err(e) => return Err(e.into()),
}

Prevention

When it happens

Trigger: 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.

Common situations: 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.

Understand the failure class

Background: Invalid enum value errors: "Unknown type", "Invalid scope", "must be one of" — when a string is not on the library's allowed list — this error's family across 23 libraries.

Related errors


AI-assisted analysis of nautechsystems/nautilus_trader@18893faf8b (2026-09-08). Data as JSON: /api/errors/67a74bf1ef13a6f6. Report an issue: GitHub.