{"record":{"id":"d89cd89288a60590","repo":"nautechsystems/nautilus_trader","slug":"missing-data-in-collectprotocol-event-log","errorCode":null,"errorMessage":"Missing data in CollectProtocol event log","messagePattern":"Missing data in CollectProtocol event log","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"crates/adapters/blockchain/src/exchanges/parsing/uniswap_v3/fee_protocol_collect.rs","lineNumber":101,"sourceCode":"                .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\n        Ok(FeeProtocolCollectEvent::new(\n            dex,\n            pool_identifier,\n            extract_block_number(log)?,\n            extract_transaction_hash(log)?,\n            extract_transaction_index(log)?,\n            extract_log_index(log)?,\n            sender,\n            recipient,\n            decoded.amount0,\n            decoded.amount1,\n        ))\n    } else {\n        anyhow::bail!(\"Missing data in CollectProtocol event log\");\n    }\n}\n\n/// Parses a `CollectProtocol` event from an RPC log.\n///\n/// # Errors\n///\n/// Returns an error if the log parsing fails or if the event data is invalid.\npub fn parse_fee_protocol_collect_event_rpc(\n    dex: SharedDex,\n    log: &RpcLog,\n) -> anyhow::Result<FeeProtocolCollectEvent> {\n    rpc_log::validate_event_signature(\n        log,\n        FEE_PROTOCOL_COLLECT_EVENT_SIGNATURE_HASH,\n        \"CollectProtocol\",\n    )?;\n","sourceCodeStart":83,"sourceCodeEnd":119,"githubUrl":"https://github.com/nautechsystems/nautilus_trader/blob/18893faf8b356be3320add8de2f861b0b647cf06/crates/adapters/blockchain/src/exchanges/parsing/uniswap_v3/fee_protocol_collect.rs#L83-L119","documentation":"Raised by parse_fee_protocol_collect_event_hypersync when the CollectProtocol log has no data field at all (log.data is None). The event requires amount0 and amount1 in the data section, so without data there is nothing to decode and the parser bails.","triggerScenarios":"A HyperSync log where data is None/null; accidentally passing an event with all parameters indexed (no data section); fixtures built without the data field.","commonSituations":"Provider responses omitting data for some logs; filtering with a too-broad topic0 catching fully-indexed variants; test helpers constructing minimal logs.","solutions":["Ensure log.data is Some with >= 64 bytes before calling the parser","Filter by the exact CollectProtocol topic0 so only correct event shapes arrive","Re-fetch the log from HyperSync if data is unexpectedly absent","Return Ok(None)/skip for logs without data instead of treating them as errors"],"exampleFix":"// before\nlet event = parse_fee_protocol_collect_event_hypersync(&dex, &log)?;\n// after\nif log.data.is_none() {\n    tracing::warn!(\"CollectProtocol log missing data, skipping\");\n    return Ok(None);\n}\nlet event = parse_fee_protocol_collect_event_hypersync(&dex, &log)?;","handlingStrategy":"type-guard","validationCode":"if log.data.is_none() {\n    tracing::warn!(\"CollectProtocol log has no data, skipping\");\n    return Ok(None);\n}\nlet event = parse_fee_protocol_collect_event_hypersync(&dex, &log)?;","typeGuard":"fn has_data(log: &Log) -> bool {\n    log.data.as_deref().map_or(false, |d| d.len() >= 64)\n}\n// if !has_data(&log) { skip }","tryCatchPattern":"match parse_fee_protocol_collect_event_hypersync(&dex, &log) {\n    Ok(event) => handle(event),\n    Err(e) if e.to_string().contains(\"Missing data\") => {\n        tracing::warn!(\"CollectProtocol log without data, skipping\");\n        Ok(None)\n    }\n    Err(e) => return Err(e),\n}","preventionTips":["Never parse events whose parameters are not fully indexed without data","Check log.data presence in ingestion pre-conditions","Re-fetch from provider when data is unexpectedly null","Cover data-less logs in tests"],"tags":["blockchain","uniswap-v3","fee-protocol","missing-data"],"backgroundTag":"missing-required-argument","analyzedSha":"18893faf8b356be3320add8de2f861b0b647cf06","analyzedAt":"2026-09-08T20:49:34.690Z","contentChangedAt":"2026-09-08T20:49:34.690Z","schemaVersion":2},"datasetVersion":"2026-09-14T05:17:10.506Z"}