nautechsystems/nautilus_trader · error

Missing data in flash event log

Error message

Missing data in flash event log

What it means

Thrown by parse_flash_event_hypersync when the hypersync log's data field is None. A Flash event always carries four non-indexed parameters in data, so a log without data cannot be parsed and the parser bails instead of decoding.

Source

Thrown at crates/adapters/blockchain/src/exchanges/parsing/uniswap_v3/flash.rs:102

        );
        let pool_identifier = PoolIdentifier::Address(Ustr::from(&pool_address.to_string()));

        Ok(FlashEvent::new(
            dex,
            pool_identifier,
            extract_block_number(log)?,
            extract_transaction_hash(log)?,
            extract_transaction_index(log)?,
            extract_log_index(log)?,
            sender,
            recipient,
            decoded.amount0,
            decoded.amount1,
            decoded.paid0,
            decoded.paid1,
        ))
    } else {
        anyhow::bail!("Missing data in flash event log");
    }
}

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

    let sender = rpc_log::extract_address_from_topic(log, 1, "sender")?;
    let recipient = rpc_log::extract_address_from_topic(log, 2, "recipient")?;

    let data_bytes = rpc_log::extract_data_bytes(log)?;

    // Validate if data contains 4 parameters of 32 bytes each
    if data_bytes.len() < 4 * 32 {

View on GitHub (pinned to 18893faf8b)

Solutions

  1. Include the data field in the hypersync log query selection.
  2. Filter by the Flash topic0 so only events that must carry data are parsed.
  3. Skip logs with log.data.is_none() before invoking the parser.
  4. Update fixtures to include 128 bytes of data.

Example fix

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

Strategy: type-guard

Validate before calling

if log.data.is_none() {
    return Ok(None); // skip dataless logs
}

Type guard

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

Try / catch

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

Prevention

When it happens

Trigger: log.data is None when the parser reaches the else branch — the hypersync query omitted the data field, or the log matched only on address/topics.

Common situations: Hypersync query field selection missing log.data; events from the same pool address that are not Flash; fixtures without data in test_parse_flash_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/16f86b886749120e. Report an issue: GitHub.