nautechsystems/nautilus_trader · error

Initialize event data is too short

Error message

Initialize event data is too short

What it means

Thrown by parse_initialize_event_hypersync when a Hypersync log's data payload is shorter than 64 bytes, i.e. it cannot contain the two 32-byte words (sqrtPriceX96, tick) required by the Uniswap V3 Initialize event. It is a fast-fail guard before attempting ABI decode, so no decode error detail is available — the data is simply too small.

Source

Thrown at crates/adapters/blockchain/src/exchanges/parsing/uniswap_v3/initialize.rs:59

/// # Errors
///
/// Returns an error if the log parsing fails or if the event data is invalid.
///
/// # Panics
///
/// Panics if the contract address is not set in the log.
pub fn parse_initialize_event_hypersync(
    dex: SharedDex,
    log: &HypersyncLog,
) -> anyhow::Result<InitializeEvent> {
    validate_event_signature_hash("InitializeEvent", INITIALIZE_EVENT_SIGNATURE_HASH, log)?;

    if let Some(data) = &log.data {
        let data_bytes = data.as_ref();

        // Validate if data contains 2 parameters of 32 bytes each (sqrtPriceX96 and tick)
        if data_bytes.len() < 2 * 32 {
            anyhow::bail!("Initialize event data is too short");
        }

        // Decode the data using the InitializeEventData struct
        let decoded = match <InitializeEventData as SolType>::abi_decode(data_bytes) {
            Ok(decoded) => decoded,
            Err(e) => anyhow::bail!("Failed to decode initialize event data: {e}"),
        };

        let pool_address = Address::from_slice(
            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(InitializeEvent::new(
            dex,

View on GitHub (pinned to 18893faf8b)

Solutions

  1. Ensure the Hypersync query selects log data (include the data field in the log selection) before parsing.
  2. Verify the log's topic0 matches the standard Uniswap V3 Initialize signature and originates from a V3 pool.
  3. Log data_bytes.len() to confirm the payload size; it must be >= 64 bytes.
  4. If building test fixtures, populate data with two 32-byte words (sqrtPriceX96 and tick).

Example fix

// before: query without data
LogSelection { inner: vec![topic0], ..Default::default() }
// after: request data
LogSelection { inner: vec![topic0], field_selection: LogFieldSelection { data: vec![0], ..Default::default() } }
Defensive patterns

Strategy: validation

Validate before calling

// Before calling parse_initialize_event_hypersync
fn has_initialize_data(log: &HypersyncLog) -> bool {
    log.data.as_ref().map(|d| d.as_ref().len() >= 64).unwrap_or(false)
}
if !has_initialize_data(&log) { continue; }

Type guard

fn has_data(log: &HypersyncLog) -> bool {
    matches!(log.data, Some(ref d) if d.len() >= 2 * 32)
}

Try / catch

match parse_initialize_event_hypersync(log, dex) {
    Ok(event) => process(event),
    Err(e) if e.to_string().contains("too short") => {
        log::debug!("log missing data (check hypersync field_selection): {e}");
    }
    Err(e) => return Err(e),
}

Prevention

When it happens

Trigger: A Hypersync log matching the Initialize topic0 but carrying an empty or short data field, e.g. data is null/empty because the hypersync query did not request the data field, or a synthetic/malformed log in tests.

Common situations: Forgetting to select the log data column in a Hypersync query (data arrives None/empty), indexing a contract emitting a same-signature event with fewer parameters, or hand-built test logs missing data.

Understand the failure class

Background: Schema validation failed / invalid input schema: payload rejected because its shape doesn't match the expected schema — this error's family across 28 libraries.

Related errors


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