{"record":{"id":"464af324332698c0","repo":"nautechsystems/nautilus_trader","slug":"missing-data-in-swap-event-log","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/pancakeswap_v3/swap.rs","lineNumber":101,"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 PancakeSwap V3 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    if data_bytes.len() < 7 * 32 {\n        anyhow::bail!(\"Swap event data is too short\");","sourceCodeStart":83,"sourceCodeEnd":119,"githubUrl":"https://github.com/nautechsystems/nautilus_trader/blob/18893faf8b356be3320add8de2f861b0b647cf06/crates/adapters/blockchain/src/exchanges/parsing/pancakeswap_v3/swap.rs#L83-L119","documentation":"parse_swap_event_hypersync throws this when the optional data field of the decoded swap event log is absent, so the swap's numeric parameters (amount0/amount1, sqrtPriceX96, liquidity, tick) cannot be produced. It is a guard against incomplete log records returned by the hypersync data source.","triggerScenarios":"A hypersync log for the PancakeSwap V3 Swap event arrives with data == None, e.g. the source filtered out the data field or the record is truncated/corrupt.","commonSituations":"Data-source misconfiguration excluding log data fields; partial ingestion during chain reorgs or outages; malformed records from an indexing provider outage.","solutions":["Re-query the log without excluding the data field from the hypersync column selection","Skip/requeue the incomplete record and retry later — the original log cannot be reconstructed client-side","Verify the subscription/filter is set to fetch full log data, not just topics","Check provider status; fetch the same block via RPC as a fallback"],"exampleFix":"// before\nlet parsed = parse_swap_event_hypersync(&log)?;\n// after\nmatch parse_swap_event_hypersync(&log) {\n    Ok(p) => p,\n    Err(e) if e.to_string().contains(\"Missing data\") => { requeue_log(&log); continue; }\n    Err(e) => return Err(e),\n}","handlingStrategy":"try-catch","validationCode":"fn hypersync_log_has_data(log: &Log) -> bool { log.data.is_some() }","typeGuard":"fn log_data(log: &Log) -> Option<&Bytes> { log.data.as_ref() }","tryCatchPattern":"match parse_swap_event_hypersync(&log) {\n    Ok(p) => use(p),\n    Err(e) if e.to_string() == \"Missing data in swap event log\" => { requeue(&log); Ok(()) },\n    Err(e) => Err(e),\n}","preventionTips":["Include the data column in hypersync query selections","Skip-and-retry incomplete records instead of aborting the run","Monitor provider health and fall back to RPC for missing logs","Alert on elevated rates of incomplete log records"],"tags":["ethereum","logs","missing-data","parsing"],"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"}