nautechsystems/nautilus_trader · error

Missing timestamp

Error message

Missing timestamp

What it means

transform_hypersync_block requires the block timestamp to build the Block's UnixNanos time. When HyperSync returns a block without a timestamp (None), the transform fails with this error instead of producing a Block with an unknown time. Timestamps are mandatory because downstream event aggregation and ordering depend on them.

Solutions

  1. Include timestamp in the HyperSync query's selected fields so every block carries it.
  2. Confirm the block record actually has a timestamp for the target chain (e.g. skip chains without block timestamps).
  3. If a default is acceptable, fall back to 0 or the parent block's timestamp instead of erroring.
  4. Check that the queried block range refers to finalized blocks, not pending ones lacking timestamps.

Example fix

// before
let timestamp = from_str_hex_to_u64(
    received_block.timestamp.ok_or_else(|| anyhow::anyhow!("Missing timestamp"))?.encode_hex().as_str(),
)?;
// after (defaulting when absent)
let timestamp = received_block
    .timestamp
    .map(|t| from_str_hex_to_u64(t.encode_hex().as_str()))
    .transpose()?
    .unwrap_or(0);
Defensive patterns

Strategy: validation

Validate before calling

fn block_has_timestamp(b: &hypersync_client::simple_types::Block) -> bool {
    b.timestamp.is_some()
}
// skip or backfill blocks where this returns false

Type guard

fn has_timestamp(b: &hypersync_client::simple_types::Block) -> bool {
    matches!(b.timestamp, Some(_))
}

Try / catch

match transform_hypersync_block(chain, block) {
    Ok(b) => process(b),
    Err(e) if e.to_string().contains("Missing timestamp") => {
        tracing::warn!(block = ?block.number, "block missing timestamp; requerying");
    }
    Err(e) => return Err(e),
}

Prevention

When it happens

Trigger: pool_events_from_response receiving a HyperSync block where timestamp is None — typically because the query projection omitted the timestamp field or the provider returned an incomplete block record.

Common situations: Building HyperSync queries with selective column lists that forgot to include timestamp; chain integrations where timestamps are absent for early-genesis or pending blocks; stale hypersync-client schema mismatches.

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


AI-assisted analysis of nautechsystems/nautilus_trader@18893faf8b (2026-09-08). Data as JSON: /api/errors/4df1194ce0128b73. Report an issue: GitHub.

Appendix: source

Thrown at crates/adapters/blockchain/src/hypersync/transform.rs:51

        .ok_or_else(|| anyhow::anyhow!("Missing block number"))?;
    let gas_limit = from_str_hex_to_u64(
        received_block
            .gas_limit
            .ok_or_else(|| anyhow::anyhow!("Missing gas limit"))?
            .encode_hex()
            .as_str(),
    )?;
    let gas_used = from_str_hex_to_u64(
        received_block
            .gas_used
            .ok_or_else(|| anyhow::anyhow!("Missing gas used"))?
            .encode_hex()
            .as_str(),
    )?;
    let timestamp = from_str_hex_to_u64(
        received_block
            .timestamp
            .ok_or_else(|| anyhow::anyhow!("Missing timestamp"))?
            .encode_hex()
            .as_str(),
    )?;

    let mut block = Block::new(
        received_block
            .hash
            .ok_or_else(|| anyhow::anyhow!("Missing hash"))?
            .to_string(),
        received_block
            .parent_hash
            .ok_or_else(|| anyhow::anyhow!("Missing parent hash"))?
            .to_string(),
        number,
        Ustr::from(
            received_block
                .miner
                .ok_or_else(|| anyhow::anyhow!("Missing miner"))?

View on GitHub (pinned to 18893faf8b)