nautechsystems/nautilus_trader · error
Missing tickUpper in topic3 when parsing collect event
Error message
Missing tickUpper in topic3 when parsing collect event
What it means
Raised by parse_collect_event_hypersync when the Collect event log lacks topic3, which holds the indexed tickUpper int24 value. Without tickUpper the position range cannot be reconstructed, so the function bails instead of producing a wrong CollectEvent.
Source
Thrown at crates/adapters/blockchain/src/exchanges/parsing/uniswap_v3/collect.rs:78
let owner = extract_address_from_topic(log, 1, "owner")?;
// Extract int24 tickLower from topic2 (stored as a 32-byte padded value)
let tick_lower = match log.topics.get(2).and_then(|t| t.as_ref()) {
Some(topic) => {
let tick_lower_bytes: [u8; 32] = topic.as_ref().try_into()?;
i32::from_be_bytes(tick_lower_bytes[28..32].try_into()?)
}
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.addressView on GitHub (pinned to 18893faf8b)
Solutions
- Filter logs by the exact Collect event topic0 signature before parsing
- Assert topics.len() >= 4 with all slots present before calling the parser
- Re-verify the Collect event signature against the Uniswap V3 pool ABI in use
- Inspect the raw log topics to identify the actually delivered event
Example fix
// before
let event = parse_collect_event_hypersync(&dex, &log)?;
// after
anyhow::ensure!(log.topics.len() >= 4, "Collect log missing topics: {:?}", log.topics);
let event = parse_collect_event_hypersync(&dex, &log)?; Defensive patterns
Strategy: validation
Validate before calling
fn has_collect_topics(log: &Log) -> bool {
log.topics.len() >= 4 && log.topics[3].is_some()
}
// require this before parse_collect_event_hypersync Type guard
fn topic_at(log: &Log, i: usize) -> Option<&[u8; 32]> {
log.topics.get(i).and_then(|t| t.as_deref())
} Try / catch
match parse_collect_event_hypersync(&dex, &log) {
Ok(event) => handle(event),
Err(e) if e.to_string().contains("Missing tickUpper") => {
tracing::warn!("Collect log missing topic3, skipping");
}
Err(e) => return Err(e),
} Prevention
- Filter subscriptions by the full Collect signature, not just name
- Check topics.len() >= 4 in ingestion pre-conditions
- Keep event-signature constants in one shared module to avoid drift
- Add fixture tests covering logs with missing topics
When it happens
Trigger: Parsing a log with fewer than 4 topics, a mismatched event (wrong topic0 filter), or a provider response with a null topic3.
Common situations: Broad topic filters catching other pool events; malformed or hand-built test logs; ABI/signature drift between the adapter and deployed pool contract.
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
- Missing tickLower in topic2 when parsing collect event
- Missing tickLower in topic2 when parsing burn event
- Missing fee in topic3 when parsing pool created event
- Swap event data is too short
- Failed to decode swap event data: {e}
AI-assisted analysis of nautechsystems/nautilus_trader@18893faf8b (2026-09-08).
Data as JSON: /api/errors/5fa57483c1c8bc6f.
Report an issue: GitHub.