{"record":{"id":"a800440d494cc474","repo":"nautechsystems/nautilus_trader","slug":"missing-transaction-hash","errorCode":null,"errorMessage":"Missing transaction hash","messagePattern":"Missing transaction hash","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"crates/adapters/blockchain/src/rpc/log.rs","lineNumber":74,"sourceCode":"///\n/// Returns an error if the block number is missing or cannot be parsed.\npub fn extract_block_number(log: &RpcLog) -> anyhow::Result<u64> {\n    let hex = log\n        .block_number\n        .as_ref()\n        .ok_or_else(|| anyhow::anyhow!(\"Missing block number\"))?;\n    parse_hex_u64(hex)\n}\n\n/// Extract transaction hash from RPC log.\n///\n/// # Errors\n///\n/// Returns an error if the transaction hash is missing.\npub fn extract_transaction_hash(log: &RpcLog) -> anyhow::Result<String> {\n    log.transaction_hash\n        .clone()\n        .ok_or_else(|| anyhow::anyhow!(\"Missing transaction hash\"))\n}\n\n/// Extract transaction index from RPC log.\n///\n/// # Errors\n///\n/// Returns an error if the transaction index is missing or cannot be parsed.\npub fn extract_transaction_index(log: &RpcLog) -> anyhow::Result<u32> {\n    let hex = log\n        .transaction_index\n        .as_ref()\n        .ok_or_else(|| anyhow::anyhow!(\"Missing transaction index\"))?;\n    parse_hex_u32(hex)\n}\n\n/// Extract log index from RPC log.\n///\n/// # Errors","sourceCodeStart":56,"sourceCodeEnd":92,"githubUrl":"https://github.com/nautechsystems/nautilus_trader/blob/18893faf8b356be3320add8de2f861b0b647cf06/crates/adapters/blockchain/src/rpc/log.rs#L56-L92","documentation":"This error means the RpcLog's transaction_hash field is None when extract_transaction_hash is called. The transaction hash is expected on every confirmed log, so its absence indicates a pending log, a synthetic log, or an incomplete RPC response. Thrown before any parsing, as a simple Option unwrap guard.","triggerScenarios":"Calling extract_transaction_hash on a pending-transaction log, a hand-built RpcLog, or JSON deserialized from a response that omitted transactionHash.","commonSituations":"Pending log subscriptions, lightweight providers that trim log payloads, or tests using minimal fixtures without hashes.","solutions":["Wait for transaction confirmation before processing logs.","Skip logs lacking a transaction hash (they cannot be attributed to a tx).","Check the RPC provider's response shape — some providers use different field casing; verify deserialization maps transactionHash correctly.","Populate transaction_hash in manually constructed test logs."],"exampleFix":"// before\nlet tx_hash = extract_transaction_hash(&log)?;\n// after\nif log.transaction_hash.is_none() {\n    return Ok(()); // skip pending/unattributed log\n}\nlet tx_hash = extract_transaction_hash(&log)?;","handlingStrategy":"try-catch","validationCode":"if log.transaction_hash.is_none() {\n    // log not attributable to a transaction — skip or defer\n}","typeGuard":"fn has_tx_hash(log: &RpcLog) -> bool { log.transaction_hash.is_some() }","tryCatchPattern":"let Ok(tx_hash) = extract_transaction_hash(&log) else {\n    skip_log(&log); return Ok(());\n};","preventionTips":["Use confirmed log streams rather than pending ones.","Check provider field naming (transactionHash) for deserialization.","Skip logs without hashes since they cannot be attributed.","Include transaction_hash in constructed fixtures."],"tags":["blockchain","rpc","missing-field","ethereum"],"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"}