nautechsystems/nautilus_trader · error

Pool created event data too short: expected at least 64 byte

Error message

Pool created event data too short: expected at least 64 bytes, was {}

What it means

parse_pool_created_event_rpc throws this (via anyhow::ensure!) when the RPC log's data section is shorter than 64 bytes, which is the minimum needed to read tick_spacing (bytes 28..32) and the pool address (bytes 32..64) for a Uniswap V3 PoolCreated event. The library validates data length up front to avoid panics from out-of-range slicing. A short data section means the log cannot be a well-formed PoolCreated event.

Source

Thrown at crates/adapters/blockchain/src/exchanges/parsing/uniswap_v3/pool_created.rs:97

///
/// # Errors
///
/// Returns an error if the log parsing fails or if the event data is invalid.
pub fn parse_pool_created_event_rpc(log: &RpcLog) -> anyhow::Result<PoolCreatedEvent> {
    rpc_log::validate_event_signature(log, POOL_CREATED_EVENT_SIGNATURE_HASH, "PoolCreatedEvent")?;

    let block_number = rpc_log::extract_block_number(log)?;
    let token0 = rpc_log::extract_address_from_topic(log, 1, "token0")?;
    let token1 = rpc_log::extract_address_from_topic(log, 2, "token1")?;

    // Extract fee from topic3
    let fee_bytes = rpc_log::extract_topic_bytes(log, 3)?;
    let fee = core::extract_u32_from_bytes(&fee_bytes)?;

    // Extract tick_spacing and pool from data
    let data_bytes = rpc_log::extract_data_bytes(log)?;

    anyhow::ensure!(
        data_bytes.len() >= 64,
        "Pool created event data too short: expected at least 64 bytes, was {}",
        data_bytes.len()
    );

    let tick_spacing = u32::from_be_bytes(data_bytes[28..32].try_into()?);
    let pool_address = Address::from_slice(&data_bytes[44..64]);

    Ok(PoolCreatedEvent::new(
        block_number,
        token0,
        token1,
        pool_address,
        PoolIdentifier::Address(Ustr::from(&pool_address.to_string())), // For V2/V3, pool_identifier = pool_address
        Some(fee),
        Some(tick_spacing),
    ))
}

View on GitHub (pinned to 18893faf8b)

Solutions

  1. Log the raw data hex and confirm the source contract is the canonical Uniswap V3 factory emitting a full 64-byte data section.
  2. Filter out logs with data.len() < 64 before calling the parser, treating them as non-V3 events.
  3. Check your RPC provider is returning complete log data (retry or use an archive node if data is truncated).
  4. Fix test fixtures to include the full 64-byte data payload.

Example fix

// before
let event = parse_pool_created_event_rpc(&log)?;
// after
if log.data.len() < 64 {
    tracing::warn!(len = log.data.len(), "skipping short PoolCreated data");
    return Ok(None);
}
let event = parse_pool_created_event_rpc(&log)?;
Defensive patterns

Strategy: validation

Validate before calling

if log.data.len() < 64 {
    // skip: not a well-formed V3 PoolCreated event
    return Ok(None);
}

Try / catch

match parse_pool_created_event_rpc(&log) {
    Ok(event) => handle(event),
    Err(e) if e.to_string().contains("data too short") => {
        tracing::warn!("short PoolCreated data; likely non-V3 event");
    }
    Err(e) => return Err(e),
}

Prevention

When it happens

Trigger: Calling parse_pool_created_event_rpc with a log whose data field is shorter than 64 bytes — e.g. an empty data section, a fork contract that emits only fee in data, or a malformed test log.

Common situations: Pointing the adapter at a non-canonical factory whose event layout differs; RPC providers returning truncated data for pruned/archived requests; hand-written unit-test logs with incomplete data; mixing up V2 PairCreated (different layout) with V3 PoolCreated.

Understand the failure class

Background: "Invalid ... format", "must be in format X", "does not look like a ..." — invalid argument format errors across CLI tools and libraries — this error's family across 17 libraries.

Related errors


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