{"record":{"id":"88645a378a560dd3","repo":"nautechsystems/nautilus_trader","slug":"profiler-receipt-contains-logs-at-global-index","errorCode":null,"errorMessage":"Profiler receipt contains {} logs at global index {}; expected exactly one","messagePattern":"Profiler receipt contains (.+?) logs at global index (.+?); expected exactly one","errorType":"validation","errorClass":"anyhow::Error","httpStatus":null,"severity":"error","filePath":"crates/adapters/blockchain/src/execution/client.rs","lineNumber":4213,"sourceCode":"        receipt.status,\n        \"Profiler transaction did not execute successfully\"\n    );\n    anyhow::ensure!(\n        receipt.transaction_hash == transaction_hash,\n        \"Profiler receipt transaction hash does not match its ingestion watermark\"\n    );\n    anyhow::ensure!(\n        receipt.block_number == position.number\n            && receipt.block_hash == expected_block_hash\n            && receipt.transaction_index == u64::from(position.transaction_index),\n        \"Profiler receipt position does not match its ingestion watermark\"\n    );\n    let matching_logs = receipt\n        .logs\n        .iter()\n        .filter(|log| rpc_log::extract_log_index(log).ok() == Some(position.log_index))\n        .collect::<Vec<_>>();\n    anyhow::ensure!(\n        matching_logs.len() == 1,\n        \"Profiler receipt contains {} logs at global index {}; expected exactly one\",\n        matching_logs.len(),\n        position.log_index\n    );\n    let log = matching_logs[0];\n    let log_transaction_hash = B256::from_str(&rpc_log::extract_transaction_hash(log)?)\n        .with_context(|| \"Invalid profiler log transaction hash\")?;\n    let log_block_hash = log\n        .block_hash\n        .as_deref()\n        .ok_or_else(|| anyhow::anyhow!(\"Profiler log has no block hash\"))?;\n    anyhow::ensure!(\n        !log.removed\n            && log_transaction_hash == transaction_hash\n            && rpc_log::extract_block_number(log)? == position.number\n            && rpc_log::extract_transaction_index(log)? == position.transaction_index\n            && B256::from_str(log_block_hash)? == expected_block_hash,","sourceCodeStart":4195,"sourceCodeEnd":4231,"githubUrl":"https://github.com/nautechsystems/nautilus_trader/blob/18893faf8b356be3320add8de2f861b0b647cf06/crates/adapters/blockchain/src/execution/client.rs#L4195-L4231","documentation":"During profiler watermark verification, the library filters the transaction receipt's logs for one whose global log index matches the ingestion watermark's log_index, and requires exactly one match. If zero or multiple logs carry that index, the watermark cannot be unambiguously resolved, so the library throws rather than guessing.","triggerScenarios":"Calling the profiler validation with a receipt whose logs either do not contain the log at position.log_index (0 matches, e.g. logs truncated by the RPC provider) or where extract_log_index returns the same index for multiple logs (duplicate indexing by a broken RPC).","commonSituations":"RPC providers that omit or truncate receipt logs; misconfigured tracing/indexing nodes; a data-feed watermark advanced past what the execution node has; provider bugs returning duplicated log entries.","solutions":["Log the receipt's full log list with extracted indices and compare against position.log_index to see whether it is 0 or >1 matches.","Re-fetch the receipt from a different/fuller RPC provider if logs appear truncated.","Verify the watermark position was produced by the same node/provider that serves the receipt.","Upgrade or fix the node indexing if duplicate log indices are returned."],"exampleFix":null,"handlingStrategy":"validation","validationCode":"let matches: Vec<_> = receipt.logs.iter()\n    .filter(|l| extract_log_index(l).ok() == Some(position.log_index))\n    .collect();\nif matches.len() != 1 { /* re-fetch receipt from another provider */ }","typeGuard":null,"tryCatchPattern":"match client.validate_watermark_log(&receipt, &position).await {\n    Ok(log) => log,\n    Err(e) if e.to_string().contains(\"expected exactly one\") => fallback_provider_fetch(e),\n    Err(e) => return Err(e),\n}","preventionTips":["Use full-fidelity RPC providers that do not truncate receipt logs","Cross-check log counts between data feed and execution node","Alert when receipt.log_len differs from the feed's expectations"],"tags":["blockchain","logs","consistency","rpc"],"backgroundTag":"unexpected-response-shape","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"}