nautechsystems/nautilus_trader · error · anyhow::Error

Error decoding `stype_out_symbol`: {e}

Error message

Error decoding `stype_out_symbol`: {e}

What it means

Same family as the stype_in error, but for the `stype_out` symbol of a Databento SymbolMappingMsg: the outbound (resolved) symbol bytes in the record cannot be decoded to a valid string. The adapter aborts the price-precision-map update for this mapping message.

Source

Thrown at crates/adapters/databento/src/live.rs:1050

}

fn update_price_precision_map_with_symbol_mapping_msg(
    msg: &dbn::SymbolMappingMsg,
    price_precision_overrides: &AHashMap<Symbol, u8>,
    subscription_price_precision_map: &mut AHashMap<u32, u8>,
) -> anyhow::Result<()> {
    subscription_price_precision_map.remove(&msg.hd.instrument_id);

    if price_precision_overrides.is_empty() {
        return Ok(());
    }

    let stype_in_symbol = msg
        .stype_in_symbol()
        .map_err(|e| anyhow::anyhow!("Error decoding `stype_in_symbol`: {e}"))?;
    let stype_out_symbol = msg
        .stype_out_symbol()
        .map_err(|e| anyhow::anyhow!("Error decoding `stype_out_symbol`: {e}"))?;

    let price_precision = [stype_in_symbol, stype_out_symbol]
        .into_iter()
        .find_map(|symbol| {
            price_precision_overrides
                .get(&Symbol::from_str_unchecked(symbol))
                .copied()
        });

    if let Some(price_precision) = price_precision {
        subscription_price_precision_map.insert(msg.hd.instrument_id, price_precision);
    }

    Ok(())
}

/// Updates the instrument ID map using exchange information from the symbol map.
fn update_instrument_id_map_with_exchange(

View on GitHub (pinned to 18893faf8b)

Solutions

  1. Ensure the `databento-dbn` dependency version matches the format emitted by the Databento gateway; upgrade the adapter and rebuild
  2. Reconnect and verify whether the error is transient; if persistent, report the malformed record to Databento
  3. Pass empty `price_precision_overrides` if precision lookup via symbol-mapping is unnecessary, bypassing this decode path
  4. Handle the error per-record (log and continue) instead of propagating it through run_session
Defensive patterns

Strategy: try-catch

Try / catch

match result {
    Ok(()) => {},
    Err(e) if e.to_string().contains("stype_out_symbol") => log::warn!("skipping mapping msg: {e}"),
    Err(e) => return Err(e),
}

Prevention

When it happens

Trigger: A SymbolMappingMsg arrives during run_session with non-empty `price_precision_overrides`, and `stype_out_symbol()` fails to decode the record's symbol bytes (invalid UTF-8/corrupt length field).

Common situations: Corrupt or truncated live/replay DBN data, version mismatch between the dbn decoder crate used by the adapter and the producer format, or altered records from a custom proxy.

Related errors


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