nautechsystems/nautilus_trader · error

Missing data in SetFeeProtocol event log

Error message

Missing data in SetFeeProtocol event log

What it means

Thrown by parse_fee_protocol_update_event_hypersync when the hypersync log has no data field (log.data is None). A SetFeeProtocol event always carries four non-indexed parameters in data, so a dataless log cannot be a valid SetFeeProtocol event and is rejected.

Source

Thrown at crates/adapters/blockchain/src/exchanges/parsing/uniswap_v3/fee_protocol_update.rs:98

            log.address
                .clone()
                .expect("Contract address should be set in logs")
                .as_ref(),
        );
        let pool_identifier = PoolIdentifier::Address(Ustr::from(&pool_address.to_string()));

        Ok(FeeProtocolUpdateEvent::new(
            dex,
            pool_identifier,
            extract_block_number(log)?,
            extract_transaction_hash(log)?,
            extract_transaction_index(log)?,
            extract_log_index(log)?,
            u32::from(decoded.fee_protocol0_new),
            u32::from(decoded.fee_protocol1_new),
        ))
    } else {
        anyhow::bail!("Missing data in SetFeeProtocol event log");
    }
}

/// Parses a `SetFeeProtocol` event from an RPC log.
///
/// # Errors
///
/// Returns an error if the log parsing fails or if the event data is invalid.
pub fn parse_fee_protocol_update_event_rpc(
    dex: SharedDex,
    log: &RpcLog,
) -> anyhow::Result<FeeProtocolUpdateEvent> {
    rpc_log::validate_event_signature(
        log,
        FEE_PROTOCOL_UPDATE_EVENT_SIGNATURE_HASH,
        "SetFeeProtocol",
    )?;

View on GitHub (pinned to 18893faf8b)

Solutions

  1. Ensure the hypersync query includes the data field in its log selection.
  2. Filter logs by the SetFeeProtocol topic0 so only events that necessarily carry data are parsed.
  3. Before calling the parser, skip logs where log.data.is_none().
  4. Fix test fixtures to include a data field with 128 bytes of payload.

Example fix

// before
parse_fee_protocol_update_event_hypersync(dex, log)?;
// after
if log.data.is_none() {
    continue; // skip dataless logs before parsing
}
parse_fee_protocol_update_event_hypersync(dex, log)?;
Defensive patterns

Strategy: type-guard

Validate before calling

if log.data.is_none() {
    // skip before calling the parser
    return Ok(None);
}

Type guard

fn has_data(log: &HypersyncLog) -> bool {
    log.data.as_ref().map(|d| !d.is_empty()).unwrap_or(false)
}

Try / catch

match parse_fee_protocol_update_event_hypersync(dex, &log) {
    Ok(event) => handle(event),
    Err(e) if e.to_string().contains("Missing data in SetFeeProtocol") => Ok(None),
    Err(e) => return Err(e),
}

Prevention

When it happens

Trigger: A hypersync log where the Option<data> is None reaches the else branch — e.g. the query did not request the data field, or the log matched only on topics/address.

Common situations: Hypersync queries constructed without selecting log.data; events that share the address but only have indexed topics; tests feeding a log fixture lacking data (test_parse_fee_protocol_update_event_hypersync).

Understand the failure class

Background: "missing required argument" and "the following required arguments were not provided": what required-argument errors mean and how to fix them — this error's family across 20 libraries.

Related errors


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