nautechsystems/nautilus_trader · error

Failed to parse full transaction in eth_getBlockByNumber res

Error message

Failed to parse full transaction in eth_getBlockByNumber response

What it means

When `block_by_tag` fetches a block with `full_transactions: true`, each transaction in the response is deserialized from its JSON value into the library's transaction type. This error is raised if any transaction object in the `eth_getBlockByNumber` response cannot be parsed — the block envelope was valid, but a transaction's shape or field types are unexpected.

Source

Thrown at crates/adapters/blockchain/src/rpc/http.rs:700

    async fn block_by_tag(&self, tag: &str, full_transactions: bool) -> anyhow::Result<RpcBlock> {
        let result: Option<RpcBlockResponse> = self
            .execute_execution_rpc_call(
                "eth_getBlockByNumber",
                serde_json::json!([tag, full_transactions]),
            )
            .await?;
        let response = result.ok_or_else(|| {
            anyhow::anyhow!("eth_getBlockByNumber returned no result for block tag {tag}")
        })?;
        let mut block = response.block;
        if full_transactions {
            block.transactions = response
                .transactions
                .into_iter()
                .map(|transaction| {
                    serde_json::from_value(transaction).map_err(|_| {
                        anyhow::anyhow!(
                            "Failed to parse full transaction in eth_getBlockByNumber response"
                        )
                    })
                })
                .collect::<anyhow::Result<_>>()?;
        }
        Ok(block)
    }

    /// Returns the receipt for the given transaction hash via `eth_getTransactionReceipt`.
    ///
    /// A `null` result maps to `Ok(None)`: the transaction is pending and no receipt
    /// exists yet.
    ///
    /// # Errors
    ///
    /// Returns an error if the RPC call fails or the response is malformed.
    pub async fn get_transaction_receipt(

View on GitHub (pinned to 18893faf8b)

Solutions

  1. Check the inner serde message by reproducing the call and inspecting the raw JSON transaction objects
  2. Upgrade the adapter to a version that supports the transaction types the node emits
  3. Use `full_transactions: false` if only block headers are needed, avoiding per-tx parsing
  4. Exclude non-standard transaction types at the node level or use a mainstream chain/node combo

Example fix

// before: adapter predates blob transactions
let block = client.block_by_number(height, true).await?; // Err parsing EIP-4844 tx
// after: upgrade adapter, or fetch headers only
let block = client.block_by_number(height, false).await?;
Defensive patterns

Strategy: fallback

Type guard

fn transactions_parseable(block_json: &serde_json::Value) -> bool {
    block_json["transactions"].as_array().map(|txs| {
        txs.iter().all(|t| t.get("hash").map(|h| h.is_string()).unwrap_or(false))
    }).unwrap_or(true)
}

Try / catch

match client.block_by_number(height, true).await {
    Ok(b) => Ok(b),
    Err(e) if e.to_string().contains("Failed to parse full transaction") => {
        log::warn!("unsupported tx shape; degrading to headers-only");
        client.block_by_number(height, false).await
    }
    Err(e) => Err(e),
}

Prevention

When it happens

Trigger: A transaction in the full-transaction array has missing/unexpected fields: non-standard transaction types (e.g. newer EIP-2718 typed transactions the library version doesn't know), null `to`/fields in unexpected places, or node-specific extra/mis-typed fields breaking serde deserialization.

Common situations: Running an adapter version older than a new transaction type (e.g. blobs/EIP-4844 or future EIPs) against a node that includes them; exotic chains with extra fields; node returning `null` where the library expects a value.

Understand the failure class

Background: "failed to unmarshal" / json.Unmarshal errors: why parsing a response into a Go struct fails and how to fix it — this error's family across 23 libraries.

Related errors


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