{"record":{"id":"ebe97505eaf60136","repo":"nautechsystems/nautilus_trader","slug":"missing-data-in-initialize-event-log-ebe975","errorCode":null,"errorMessage":"Missing data in initialize event log","messagePattern":"Missing data in initialize event log","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"crates/adapters/blockchain/src/exchanges/parsing/uniswap_v4/initialize.rs","lineNumber":152,"sourceCode":"        let decoded = <InitializeEventData as SolType>::abi_decode(data_bytes)\n            .map_err(|e| anyhow::anyhow!(\"Failed to decode initialize event data: {e}\"))?;\n\n        let mut event = PoolCreatedEvent::new(\n            block_number,\n            currency0,\n            currency1,\n            pool_manager_address, // V4 pools are managed by PoolManager\n            PoolIdentifier::PoolId(pool_identifier), // Pool ID (bytes32 as hex string)\n            Some(decoded.fee.to::<u32>()),\n            Some(i32::try_from(decoded.tick_spacing)? as u32),\n        );\n\n        event.set_initialize_params(decoded.sqrtPriceX96, i32::try_from(decoded.tick)?);\n        event.set_hooks(decoded.hooks);\n\n        Ok(event)\n    } else {\n        Err(anyhow::anyhow!(\"Missing data in initialize event log\"))\n    }\n}\n\n/// Parses a UniswapV4 Initialize 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_initialize_event_rpc(log: &RpcLog) -> anyhow::Result<PoolCreatedEvent> {\n    rpc_log::validate_event_signature(log, INITIALIZE_EVENT_SIGNATURE_HASH, \"InitializeEvent\")?;\n\n    let block_number = rpc_log::extract_block_number(log)?;\n\n    // Pool address is the PoolManager contract (event emitter)\n    let pool_manager_bytes = rpc_log::decode_hex(&log.address)?;\n    let pool_manager_address = Address::from_slice(&pool_manager_bytes);\n\n    // Extract currency0 and currency1 from topics","sourceCodeStart":134,"sourceCodeEnd":170,"githubUrl":"https://github.com/nautechsystems/nautilus_trader/blob/18893faf8b356be3320add8de2f861b0b647cf06/crates/adapters/blockchain/src/exchanges/parsing/uniswap_v4/initialize.rs#L134-L170","documentation":"Thrown by `parse_initialize_event_hypersync` when the log has valid indexed topics but `log.data` is `None`. A Uniswap V4 Initialize event always carries non-indexed data (sqrtPriceX96, tick, fees, hooks), so the parser cannot construct a `PoolCreatedEvent` without it and returns an error instead of a partial event.","triggerScenarios":"Calling `parse_initialize_event_hypersync` with a HyperSync log where `data` is null. Happens when the HyperSync query field selection omits the `data` column, or the log is an unrelated event matched by an over-broad topic filter.","commonSituations":"Building a HyperSync query with a reduced field selection that drops `log.data`; using a topic0 filter that matches anonymous/partially-similar events; decoding archived logs where data was not requested.","solutions":["Include the `data` field in the HyperSync query's log field selection (field_selection.log: [data, topics, ...]).","Ensure the topic0 filter exactly matches the Uniswap V4 Initialize signature so only real Initialize logs are parsed.","Return Ok(None)/skip the log instead of erroring when data is absent, if partial logs are expected.","Re-fetch the specific log by block/tx if the indexer omitted data."],"exampleFix":"// before\n} else {\n    Err(anyhow::anyhow!(\"Missing data in initialize event log\"))\n}\n// after\n} else {\n    tracing::warn!(?log, \"Initialize log without data; skipping\");\n    return Ok(None);\n}","handlingStrategy":"validation","validationCode":"// ensure the HyperSync field selection includes log data\nlet field_selection = FieldSelection {\n    log: [LogField::BlockNumber, LogField::Topic0, LogField::Topic1, LogField::Topic2, LogField::Topic3, LogField::Data].into(),\n    ..Default::default()\n};","typeGuard":"fn log_has_data(log: &HypersyncLog) -> bool {\n    log.data.as_ref().map(|d| !d.as_ref().is_empty()).unwrap_or(false)\n}","tryCatchPattern":"match parse_initialize_event_hypersync(&log) {\n    Ok(ev) => store(ev),\n    Err(e) if e.to_string().contains(\"Missing data\") => skip_and_count(&log),\n    Err(e) => return Err(e),\n}","preventionTips":["Always request the Data field in HyperSync log field selections","Filter on the exact Initialize topic0 so only real Initialize logs reach the parser","Add an integration test asserting the query selection returns non-null data"],"tags":["blockchain","hypersync","event-decoding","query-config"],"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"}