nautechsystems/nautilus_trader · error
Collect event data is too short
Error message
Collect event data is too short
What it means
Raised when the HyperSync Collect log's data field is present but shorter than the 96 bytes (3 x 32) required to hold amount0, amount1 and the third ABI word of the Collect event. Truncated data cannot be ABI-decoded, so parsing stops with this error.
Source
Thrown at crates/adapters/blockchain/src/exchanges/parsing/uniswap_v3/collect.rs:86
}
None => anyhow::bail!("Missing tickLower in topic2 when parsing collect event"),
};
// Extract int24 tickUpper from topic3 (stored as a 32-byte padded value)
let tick_upper = match log.topics.get(3).and_then(|t| t.as_ref()) {
Some(topic) => {
let tick_upper_bytes: [u8; 32] = topic.as_ref().try_into()?;
i32::from_be_bytes(tick_upper_bytes[28..32].try_into()?)
}
None => anyhow::bail!("Missing tickUpper in topic3 when parsing collect event"),
};
if let Some(data) = &log.data {
let data_bytes = data.as_ref();
// Validate if data contains 3 parameters of 32 bytes each
if data_bytes.len() < 3 * 32 {
anyhow::bail!("Collect event data is too short");
}
// Decode the data using the CollectEventData struct
let decoded = match <CollectEventData as SolType>::abi_decode(data_bytes) {
Ok(decoded) => decoded,
Err(e) => anyhow::bail!("Failed to decode collect 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(CollectEvent::new(
dex,
pool_identifier,View on GitHub (pinned to 18893faf8b)
Solutions
- Check data.len() >= 96 (or log.data is None) before calling the parser
- Confirm the log's topic0 is the V3 Collect signature so the data layout matches
- Re-fetch the log from HyperSync in case of a truncated response
- Validate with a quick length check in the caller and skip bad logs
Example fix
// before let event = parse_collect_event_hypersync(&dex, &log)?; // after let ok = log.data.as_ref().map_or(true, |d| d.len() >= 3 * 32); anyhow::ensure!(ok, "Collect log data too short"); let event = parse_collect_event_hypersync(&dex, &log)?;
Defensive patterns
Strategy: validation
Validate before calling
fn collect_data_ok(log: &Log) -> bool {
log.data.as_ref().map_or(true, |d| d.len() >= 3 * 32)
}
// skip logs failing this check before parsing Type guard
fn has_full_data(log: &Log, words: usize) -> bool {
log.data.as_deref().map_or(false, |d| d.len() >= words * 32)
} Try / catch
match parse_collect_event_hypersync(&dex, &log) {
Ok(event) => handle(event),
Err(e) if e.to_string().contains("data is too short") => {
tracing::warn!("truncated Collect data, re-fetching log");
// re-fetch via tx receipt
}
Err(e) => return Err(e),
} Prevention
- Length-check data before ABI decoding (>= 3*32 for Collect)
- Re-fetch truncated logs from the provider instead of failing the batch
- Use well-known providers or verify node integrity
- Add boundary tests with short data payloads
When it happens
Trigger: A HyperSync response with truncated log.data; passing a log from an event with fewer data parameters; data encoded with a non-standard event layout.
Common situations: Provider pagination/glitches returning partial payloads; testing with sliced byte arrays; mixing logs from Uniswap V2-style Collect events with different data layouts.
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
- Failed to decode burn event data: {e}
- Failed to decode collect event data: {e}
- CollectProtocol event data is too short
- Failed to decode CollectProtocol event data: {e}
- Finalized transaction {} emitted {} Swap logs; expected exac
AI-assisted analysis of nautechsystems/nautilus_trader@18893faf8b (2026-09-08).
Data as JSON: /api/errors/38e7560a6edab3ca.
Report an issue: GitHub.