{"record":{"id":"21a17a6effe00fec","repo":"nautechsystems/nautilus_trader","slug":"missing-data-in-initialize-event-log","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_v3/initialize.rs","lineNumber":83,"sourceCode":"            Err(e) => anyhow::bail!(\"Failed to decode initialize 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\n        Ok(InitializeEvent::new(\n            dex,\n            pool_identifier,\n            decoded.sqrt_price_x96,\n            i32::try_from(decoded.tick)?,\n        ))\n    } else {\n        Err(anyhow::anyhow!(\"Missing data in initialize event log\"))\n    }\n}\n\n/// Parses an 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(dex: SharedDex, log: &RpcLog) -> anyhow::Result<InitializeEvent> {\n    rpc_log::validate_event_signature(log, INITIALIZE_EVENT_SIGNATURE_HASH, \"Initialize\")?;\n\n    let data_bytes = rpc_log::extract_data_bytes(log)?;\n\n    // Validate if data contains 2 parameters of 32 bytes each (sqrtPriceX96 and tick)\n    if data_bytes.len() < 2 * 32 {\n        anyhow::bail!(\"Initialize event data is too short\");\n    }\n","sourceCodeStart":65,"sourceCodeEnd":101,"githubUrl":"https://github.com/nautechsystems/nautilus_trader/blob/18893faf8b356be3320add8de2f861b0b647cf06/crates/adapters/blockchain/src/exchanges/parsing/uniswap_v3/initialize.rs#L65-L101","documentation":"parse_initialize_event_hypersync throws this when the Hypersync-decoded Initialize event payload is None, so sqrt_price_x96 and the initial tick cannot be extracted for a newly created V3 pool. The library requires the full decode because both values are mandatory for pool-state initialization. It is the guard at the end of the success path, after topic-based pool/dex extraction.","triggerScenarios":"Calling parse_initialize_event_hypersync with a log whose decoded field is None — topic0 matched the Initialize signature but the data (sqrtPriceX96, tick) was absent, truncated, or failed Hypersync decoding.","commonSituations":"First-sync of factory/pool-created blocks where the data section was not fetched; fork contracts emitting Initialize-shaped topics with empty data; Hypersync ABI schema drift; reorg windows delivering partial logs.","solutions":["Verify the log originates from a canonical Uniswap V3 pool and carries a full 64-byte data section (sqrtPriceX96 + tick).","Ensure the Hypersync query decodes Initialize with the correct ABI so decoded is Some.","Skip and log logs with empty/short data rather than aborting the ingestion batch.","Re-sync the affected range after fixing ABI/client versions."],"exampleFix":null,"handlingStrategy":"validation","validationCode":"fn can_parse_initialize(log: &Log) -> bool {\n    log.data.len() >= 64 // sqrtPriceX96, tick words\n}","typeGuard":"fn has_decoded_initialize(decoded: &Option<InitializeDecoded>) -> bool {\n    decoded.is_some()\n}","tryCatchPattern":"match parse_initialize_event_hypersync(&log) {\n    Ok(event) => handle(event),\n    Err(e) if e.to_string().contains(\"Missing data in initialize event log\") => {\n        tracing::warn!(\"skipping malformed initialize log\");\n    }\n    Err(e) => return Err(e),\n}","preventionTips":["Filter logs lacking a full 64-byte data section before parsing.","Confirm the factory address is the canonical V3 factory.","Keep Hypersync decode schemas aligned with the adapter.","Handle reorg windows by re-fetching partial logs."],"tags":["blockchain","uniswap-v3","log-parsing","hypersync"],"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"}