{"record":{"id":"0b36bedc69eb3758","repo":"nautechsystems/nautilus_trader","slug":"failed-to-read-the-consensus-finalized-block-the","errorCode":null,"errorMessage":"Failed to read the consensus finalized block; the execution endpoint must support the finalized tag: {e}","messagePattern":"Failed to read the consensus finalized block; the execution endpoint must support the finalized tag: (.+?)","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"crates/adapters/blockchain/src/rpc/http.rs","lineNumber":656,"sourceCode":"\n    /// Returns the latest block via `eth_getBlockByNumber` with the `latest` tag.\n    ///\n    /// # Errors\n    ///\n    /// Returns an error if the RPC call fails or the result is missing or malformed.\n    pub async fn latest_block(&self) -> anyhow::Result<RpcBlock> {\n        self.block_by_tag(\"latest\", false).await\n    }\n\n    /// Returns the consensus finalized block.\n    ///\n    /// # Errors\n    ///\n    /// Returns an error if the endpoint does not support the `finalized` tag, the RPC call\n    /// fails, or the result is missing or malformed.\n    pub async fn finalized_block(&self) -> anyhow::Result<RpcBlock> {\n        self.block_by_tag(\"finalized\", false).await.map_err(|e| {\n            anyhow::anyhow!(\n                \"Failed to read the consensus finalized block; the execution endpoint must support the finalized tag: {e}\"\n            )\n        })\n    }\n\n    /// Returns a numbered canonical block, optionally with full transactions.\n    ///\n    /// # Errors\n    ///\n    /// Returns an error if the RPC call fails or the result is missing or malformed.\n    pub async fn block_by_number(\n        &self,\n        number: u64,\n        full_transactions: bool,\n    ) -> anyhow::Result<RpcBlock> {\n        let block = self\n            .block_by_tag(&format!(\"0x{number:x}\"), full_transactions)\n            .await?;","sourceCodeStart":638,"sourceCodeEnd":674,"githubUrl":"https://github.com/nautechsystems/nautilus_trader/blob/18893faf8b356be3320add8de2f861b0b647cf06/crates/adapters/blockchain/src/rpc/http.rs#L638-L674","documentation":"`finalized_block()` calls `block_by_tag(\"finalized\", ...)`, which requires the execution endpoint to support the post-merge `finalized` block tag via `eth_getBlockByNumber`. When the underlying call fails for any reason (unsupported tag, RPC failure, malformed result), the error is re-wrapped with this message telling the operator the endpoint must support the finalized tag.","triggerScenarios":"Calling `finalized_block()` against an execution node that does not implement the `finalized` tag (pre-merge clients, some third-party providers, or a consensus/execution mispair), or the underlying eth_getBlockByNumber call fails or returns null.","commonSituations":"Running an old geth/erigon version predating finalized-tag support; provider tier that excludes post-merge tags; execution endpoint not wired to a consensus client so no finalized head exists.","solutions":["Upgrade the execution client to a post-merge version supporting the `finalized` tag (geth >= v1.10.x era, reth, etc.)","Ensure the execution node is connected to a consensus client (beacon node) so finalized blocks are known","Check the inner error text (appended after the colon) for the root cause: unsupported tag vs RPC failure vs null result","If the provider does not support `finalized`, use `safe` or `latest` tags where the fork-verification config allows"],"exampleFix":"// before: old execution node without finalized tag support\n// geth v1.9.x -> upgrade\n// after\n// geth version >= 1.13 with a connected beacon node\n// curl -X POST $RPC -d '{\"jsonrpc\":\"2.0\",\"method\":\"eth_getBlockByNumber\",\"params\":[\"finalized\",false],\"id\":1}'","handlingStrategy":"fallback","validationCode":"async fn supports_finalized_tag(url: &str) -> bool {\n    send_raw(url, json!({\"jsonrpc\":\"2.0\",\"method\":\"eth_getBlockByNumber\",\"params\":[\"finalized\",false],\"id\":1}))\n        .await.ok()\n        .and_then(|v| v.get(\"result\").cloned())\n        .map(|r| !r.is_null())\n        .unwrap_or(false)\n}","typeGuard":null,"tryCatchPattern":"let block = match client.finalized_block().await {\n    Ok(b) => b,\n    Err(e) if e.to_string().contains(\"finalized\") => {\n        log::warn!(\"endpoint lacks finalized tag; falling back to safe/latest\");\n        client.latest_block().await?\n    }\n    Err(e) => return Err(e),\n};","preventionTips":["Run a post-merge execution client with a connected consensus client","Verify `eth_getBlockByNumber [\"finalized\",false]` returns a block during setup","Check provider documentation that the tier supports post-merge block tags","Read the inner error appended after the colon to distinguish tag-unsupported from RPC failure"],"tags":["rpc","ethereum","consensus","finalized-block"],"backgroundTag":"unsupported-operation","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"}