{"record":{"id":"57c0ed2e95e8fbc7","repo":"nautechsystems/nautilus_trader","slug":"missing-data-in-swap-event-log-57c0ed","errorCode":null,"errorMessage":"Missing data in swap event log","messagePattern":"Missing data in swap event log","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"crates/adapters/blockchain/src/exchanges/parsing/uniswap_v3/swap.rs","lineNumber":100,"sourceCode":"        );\n        let pool_identifier = PoolIdentifier::Address(Ustr::from(&pool_address.to_string()));\n        Ok(SwapEvent::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            decoded.sqrt_price_x96,\n            decoded.liquidity,\n            decoded.tick.as_i32(),\n        ))\n    } else {\n        Err(anyhow::anyhow!(\"Missing data in swap event log\"))\n    }\n}\n\n/// Parses a swap 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_swap_event_rpc(dex: SharedDex, log: &RpcLog) -> anyhow::Result<SwapEvent> {\n    rpc_log::validate_event_signature(log, SWAP_EVENT_SIGNATURE_HASH, \"Swap\")?;\n\n    let sender = rpc_log::extract_address_from_topic(log, 1, \"sender\")?;\n    let recipient = rpc_log::extract_address_from_topic(log, 2, \"recipient\")?;\n\n    let data_bytes = rpc_log::extract_data_bytes(log)?;\n\n    // Validate if data contains 5 parameters of 32 bytes each\n    if data_bytes.len() < 5 * 32 {","sourceCodeStart":82,"sourceCodeEnd":118,"githubUrl":"https://github.com/nautechsystems/nautilus_trader/blob/18893faf8b356be3320add8de2f861b0b647cf06/crates/adapters/blockchain/src/exchanges/parsing/uniswap_v3/swap.rs#L82-L118","documentation":"parse_swap_event_hypersync throws this when the Hypersync-decoded Swap event payload is None, so amount1, sqrt_price_x96, liquidity, and tick cannot be populated for the swap. The library requires a full decode because these fields drive price/liquidity state and cannot be defaulted. It is the standard else-branch guard of the uniswap_v3 hypersync parsers.","triggerScenarios":"Calling parse_swap_event_hypersync with a log whose decoded field is None — topic0 matched the Swap signature but the data section (amount0/amount1, sqrtPriceX96, liquidity, tick) was missing, truncated, or failed Hypersync decoding.","commonSituations":"Non-standard pools emitting Swap-shaped topic0 with empty data; Hypersync ABI drift after dependency updates; partially indexed logs during reorgs; hand-crafted test logs lacking data.","solutions":["Confirm the log's data section is present and correctly sized for the canonical V3 Swap event.","Verify the Hypersync Swap ABI registration so decoding returns Some(decoded).","Filter empty-data logs upstream and log them rather than failing the ingestion batch.","Re-align adapter/Hypersync client versions and re-fetch the affected range."],"exampleFix":null,"handlingStrategy":"validation","validationCode":"fn can_parse_swap(log: &Log) -> bool {\n    log.data.len() >= 128 // amount0, amount1, sqrtPriceX96, liquidity, tick words\n}","typeGuard":"fn has_decoded_swap(decoded: &Option<SwapDecoded>) -> bool {\n    decoded.is_some()\n}","tryCatchPattern":"match parse_swap_event_hypersync(&log) {\n    Ok(event) => handle(event),\n    Err(e) if e.to_string().contains(\"Missing data in swap event log\") => {\n        tracing::warn!(\"skipping malformed swap log\");\n    }\n    Err(e) => return Err(e),\n}","preventionTips":["Filter empty/short data sections before batch swap parsing.","Keep Hypersync Swap ABI registration in sync with the adapter.","Restrict ingestion to canonical V3 pool addresses.","Alert on elevated skip rates indicating ABI drift."],"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"}