{"record":{"id":"0c25415c3324e322","repo":"nautechsystems/nautilus_trader","slug":"invalid-receipt-log-data","errorCode":null,"errorMessage":"Invalid receipt log data","messagePattern":"Invalid receipt log data","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"crates/adapters/blockchain/src/rpc/verification.rs","lineNumber":168,"sourceCode":"impl TryFrom<RpcTransactionReceipt> for VerifiedReceipt {\n    type Error = anyhow::Error;\n\n    fn try_from(receipt: RpcTransactionReceipt) -> Result<Self, Self::Error> {\n        let logs = receipt\n            .logs\n            .into_iter()\n            .map(|log| {\n                Ok(VerifiedReceiptLog {\n                    removed: log.removed,\n                    log_index: parse_optional_quantity(log.log_index.as_deref())?,\n                    transaction_index: parse_optional_quantity(log.transaction_index.as_deref())?,\n                    transaction_hash: parse_optional_hash(log.transaction_hash.as_deref())?,\n                    block_hash: parse_optional_hash(log.block_hash.as_deref())?,\n                    block_number: parse_optional_quantity(log.block_number.as_deref())?,\n                    address: Address::from_str(&log.address)\n                        .map_err(|_| anyhow::anyhow!(\"Invalid receipt log address\"))?,\n                    data: Bytes::from_str(&log.data)\n                        .map_err(|_| anyhow::anyhow!(\"Invalid receipt log data\"))?,\n                    topics: log\n                        .topics\n                        .iter()\n                        .map(|topic| {\n                            B256::from_str(topic)\n                                .map_err(|_| anyhow::anyhow!(\"Invalid receipt log topic\"))\n                        })\n                        .collect::<anyhow::Result<_>>()?,\n                })\n            })\n            .collect::<anyhow::Result<_>>()?;\n        Ok(Self {\n            transaction_hash: receipt.transaction_hash,\n            block_hash: receipt.block_hash,\n            block_number: receipt.block_number,\n            gas_used: receipt.gas_used,\n            effective_gas_price: receipt.effective_gas_price,\n            transaction_index: receipt.transaction_index,","sourceCodeStart":150,"sourceCodeEnd":186,"githubUrl":"https://github.com/nautechsystems/nautilus_trader/blob/18893faf8b356be3320add8de2f861b0b647cf06/crates/adapters/blockchain/src/rpc/verification.rs#L150-L186","documentation":"During VerifiedReceiptLog construction, the log's data field string is parsed into alloy Bytes via Bytes::from_str. On failure the underlying error is discarded and replaced with 'Invalid receipt log data'. The data string must be 0x-prefixed hex with an even number of hex digits representing arbitrary bytes.","triggerScenarios":"Verifying a receipt log whose data field is empty, missing the 0x prefix when required, contains non-hex characters, or has an odd number of hex digits so it cannot be converted into a byte vector.","commonSituations":"Upstream provider sending '0x' plus malformed payload or an odd-length hex string; fixtures with hand-typed data; a node returning data as a JSON array or base64 instead of hex; encoding changes after a provider/API version bump.","solutions":["Inspect the data string; ensure it is 0x-prefixed hex with an even digit count (0x alone is valid empty data for Bytes::from_str).","Parse with Bytes::from_str ahead of receipt construction to surface the real decode error.","If the source emits decimal/base64/non-hex data, convert it to hex before building the receipt.","Correct or regenerate the fixture/ indexer output that produced the malformed data."],"exampleFix":"// before\n\"data\": \"0xabcdef0\" // odd length\n// after\n\"data\": \"0xabcdef00\" // even-length hex bytes","handlingStrategy":"validation","validationCode":"fn is_valid_bytes_hex(s: &str) -> bool {\n    let h = s.strip_prefix(\"0x\").unwrap_or(s);\n    h.len() % 2 == 0 && h.chars().all(|c| c.is_ascii_hexdigit())\n}","typeGuard":null,"tryCatchPattern":"let data = Bytes::from_str(&log.data)\n    .map_err(|e| anyhow::anyhow!(\"Invalid receipt log data '{}}}': {e}\", log.data))?;","preventionTips":["Confirm the provider emits log data as 0x-prefixed, even-length hex.","Convert decimal/base64 payloads to hex before constructing receipts.","Pre-parse data fields when ingesting to fail fast with the real error.","Keep fixtures generated from real receipts rather than hand-typed."],"tags":["blockchain","parsing","hex","validation"],"backgroundTag":"invalid-argument-format","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"}