{"record":{"id":"38e7560a6edab3ca","repo":"nautechsystems/nautilus_trader","slug":"collect-event-data-is-too-short","errorCode":null,"errorMessage":"Collect event data is too short","messagePattern":"Collect event data is too short","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"crates/adapters/blockchain/src/exchanges/parsing/uniswap_v3/collect.rs","lineNumber":86,"sourceCode":"        }\n        None => anyhow::bail!(\"Missing tickLower in topic2 when parsing collect event\"),\n    };\n\n    // Extract int24 tickUpper from topic3 (stored as a 32-byte padded value)\n    let tick_upper = match log.topics.get(3).and_then(|t| t.as_ref()) {\n        Some(topic) => {\n            let tick_upper_bytes: [u8; 32] = topic.as_ref().try_into()?;\n            i32::from_be_bytes(tick_upper_bytes[28..32].try_into()?)\n        }\n        None => anyhow::bail!(\"Missing tickUpper in topic3 when parsing collect event\"),\n    };\n\n    if let Some(data) = &log.data {\n        let data_bytes = data.as_ref();\n\n        // Validate if data contains 3 parameters of 32 bytes each\n        if data_bytes.len() < 3 * 32 {\n            anyhow::bail!(\"Collect event data is too short\");\n        }\n\n        // Decode the data using the CollectEventData struct\n        let decoded = match <CollectEventData as SolType>::abi_decode(data_bytes) {\n            Ok(decoded) => decoded,\n            Err(e) => anyhow::bail!(\"Failed to decode collect event data: {e}\"),\n        };\n\n        let pool_address = Address::from_slice(\n            log.address\n                .clone()\n                .expect(\"Contract address should be set in logs\")\n                .as_ref(),\n        );\n        let pool_identifier = PoolIdentifier::Address(Ustr::from(&pool_address.to_string()));\n        Ok(CollectEvent::new(\n            dex,\n            pool_identifier,","sourceCodeStart":68,"sourceCodeEnd":104,"githubUrl":"https://github.com/nautechsystems/nautilus_trader/blob/18893faf8b356be3320add8de2f861b0b647cf06/crates/adapters/blockchain/src/exchanges/parsing/uniswap_v3/collect.rs#L68-L104","documentation":"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.","triggerScenarios":"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.","commonSituations":"Provider pagination/glitches returning partial payloads; testing with sliced byte arrays; mixing logs from Uniswap V2-style Collect events with different data layouts.","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"],"exampleFix":"// before\nlet event = parse_collect_event_hypersync(&dex, &log)?;\n// after\nlet ok = log.data.as_ref().map_or(true, |d| d.len() >= 3 * 32);\nanyhow::ensure!(ok, \"Collect log data too short\");\nlet event = parse_collect_event_hypersync(&dex, &log)?;","handlingStrategy":"validation","validationCode":"fn collect_data_ok(log: &Log) -> bool {\n    log.data.as_ref().map_or(true, |d| d.len() >= 3 * 32)\n}\n// skip logs failing this check before parsing","typeGuard":"fn has_full_data(log: &Log, words: usize) -> bool {\n    log.data.as_deref().map_or(false, |d| d.len() >= words * 32)\n}","tryCatchPattern":"match parse_collect_event_hypersync(&dex, &log) {\n    Ok(event) => handle(event),\n    Err(e) if e.to_string().contains(\"data is too short\") => {\n        tracing::warn!(\"truncated Collect data, re-fetching log\");\n        // re-fetch via tx receipt\n    }\n    Err(e) => return Err(e),\n}","preventionTips":["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"],"tags":["blockchain","uniswap-v3","abi","truncated-data"],"backgroundTag":"schema-validation-failed","analyzedSha":"18893faf8b356be3320add8de2f861b0b647cf06","analyzedAt":"2026-09-08T20:49:34.690Z","contentChangedAt":"2026-09-08T20:49:34.690Z","schemaVersion":2},"datasetVersion":"2026-09-14T00:17:10.932Z"}