nautechsystems/nautilus_trader · error
Missing transaction hash in log
Error message
Missing transaction hash in log
What it means
extract_transaction_hash converts a Hypersync log's optional transaction_hash into a String. The error fires when the log carries no transaction hash, which would break downstream transaction correlation, so the extractor refuses to return a value.
Source
Thrown at crates/adapters/blockchain/src/hypersync/log.rs:49
) -> anyhow::Result<Address> {
match log.topics.get(topic_index).and_then(|t| t.as_ref()) {
Some(topic) => core::extract_address_from_bytes(topic.as_ref()),
None => {
anyhow::bail!("Missing {description} address in topic{topic_index} when parsing event")
}
}
}
/// Extracts the transaction hash from a log entry
///
/// # Errors
///
/// Returns an error if the transaction hash is not present in the log.
pub fn extract_transaction_hash(log: &HypersyncLog) -> anyhow::Result<String> {
log.transaction_hash
.as_ref()
.map(ToString::to_string)
.ok_or_else(|| anyhow::anyhow!("Missing transaction hash in log"))
}
/// Extracts the transaction index from a log entry
///
/// # Errors
///
/// Returns an error if the transaction index is not present in the log.
pub fn extract_transaction_index(log: &HypersyncLog) -> anyhow::Result<u32> {
log.transaction_index
.as_ref()
.map(|index| **index as u32)
.ok_or_else(|| anyhow::anyhow!("Missing transaction index in the log"))
}
/// Extracts the log index from a log entry
///
/// # Errors
///View on GitHub (pinned to 18893faf8b)
Solutions
- Filter or re-fetch the log entry so transaction_hash is populated before extraction
- Check the hypersync-client version / API schema for known fields returning None
- Skip or batch-retry the affected logs in the ingestion loop
- Log the offending log payload and report it if HyperSync persistently omits the hash
Example fix
// before
let tx_hash = extract_transaction_hash(&log)?;
// after
if log.transaction_hash.is_some() {
let tx_hash = extract_transaction_hash(&log)?;
} else {
tracing::warn!("skipping log without tx hash");
} Defensive patterns
Strategy: validation
Validate before calling
fn has_tx_hash(log: &HypersyncLog) -> bool {
log.transaction_hash.is_some()
}
// skip logs where !has_tx_hash(&log) before calling extract_transaction_hash Type guard
fn log_has_tx_hash(log: &HypersyncLog) -> bool {
log.transaction_hash.is_some()
} Try / catch
match extract_transaction_hash(&log) {
Ok(hash) => /* use hash */,
Err(e) => { tracing::warn!("skipping log: {e}"); continue; }
} Prevention
- Always request transaction_hash in HyperSync field selections
- Validate required log fields immediately after each response page
- Pin and test against a specific hypersync-client version
When it happens
Trigger: Calling extract_transaction_hash with a HypersyncLog whose transaction_hash field is None; this occurs with malformed or partial HyperSync responses for a log entry.
Common situations: HyperSync API returning incomplete log objects (schema/version drift, partial data); decoding synthetic or filtered logs that omit the hash; network/API issues yielding truncated payloads.
Understand the failure class
Background: "missing required argument" and "the following required arguments were not provided": what required-argument errors mean and how to fix them — this error's family across 20 libraries.
Related errors
- Missing transaction index in the log
- Missing log index in the log
- Missing block number in the log
- Profiler log has no block hash
- Profiler watermark log has no event signature
AI-assisted analysis of nautechsystems/nautilus_trader@18893faf8b (2026-09-08).
Data as JSON: /api/errors/1748c647519d0b21.
Report an issue: GitHub.