{"record":{"id":"ef337e6318a44b70","repo":"nautechsystems/nautilus_trader","slug":"eth-getblockbynumber-returned-no-result-for-block","errorCode":null,"errorMessage":"eth_getBlockByNumber returned no result for block tag {tag}","messagePattern":"eth_getBlockByNumber returned no result for block tag (.+?)","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"crates/adapters/blockchain/src/rpc/http.rs","lineNumber":691,"sourceCode":"            .block_by_tag(&format!(\"0x{number:x}\"), full_transactions)\n            .await?;\n        anyhow::ensure!(\n            block.number == number,\n            \"eth_getBlockByNumber returned block {} for requested block {number}\",\n            block.number\n        );\n        Ok(block)\n    }\n\n    async fn block_by_tag(&self, tag: &str, full_transactions: bool) -> anyhow::Result<RpcBlock> {\n        let result: Option<RpcBlockResponse> = self\n            .execute_execution_rpc_call(\n                \"eth_getBlockByNumber\",\n                serde_json::json!([tag, full_transactions]),\n            )\n            .await?;\n        let response = result.ok_or_else(|| {\n            anyhow::anyhow!(\"eth_getBlockByNumber returned no result for block tag {tag}\")\n        })?;\n        let mut block = response.block;\n        if full_transactions {\n            block.transactions = response\n                .transactions\n                .into_iter()\n                .map(|transaction| {\n                    serde_json::from_value(transaction).map_err(|_| {\n                        anyhow::anyhow!(\n                            \"Failed to parse full transaction in eth_getBlockByNumber response\"\n                        )\n                    })\n                })\n                .collect::<anyhow::Result<_>>()?;\n        }\n        Ok(block)\n    }\n","sourceCodeStart":673,"sourceCodeEnd":709,"githubUrl":"https://github.com/nautechsystems/nautilus_trader/blob/18893faf8b356be3320add8de2f861b0b647cf06/crates/adapters/blockchain/src/rpc/http.rs#L673-L709","documentation":"`block_by_tag` executes `eth_getBlockByNumber` and expects a block object back; when the node responds with `null` (JSON-RPC `result: null`), the library converts that to this error. Per the eth_getBlockByNumber spec, null means no block exists for the tag, so the library refuses to fabricate an empty block.","triggerScenarios":"Requesting a block tag that the node has no block for: a height in the future or below the pruned horizon with no archive data, the `finalized` tag when no finalized head exists yet, or a reorg orphaning the requested height.","commonSituations":"Freshly synced node without archive history queried for old heights; `finalized` tag on a node lacking a consensus client; querying a pending/future block number; provider tiers without archive access.","solutions":["Check the requested tag/height exists: compare against `eth_blockNumber` (head) and node history depth","For old heights use an archive node; pruned full nodes return null for pruned bodies/heights","For `finalized`, confirm the execution node has a connected consensus client and a finalized head","Retry if a reorg may have transiently orphaned the height"],"exampleFix":"// before: pruned node asked for a deep historical block -> null\nlet block = client.block_by_tag(\"0x3a2f1\", false).await?; // Err: returned no result\n// after: use an archive endpoint for historical heights\nlet block = if height < SAFE_DEPTH { archive_client.block_by_tag(tag, false).await? } else { full_client.block_by_tag(tag, false).await? };","handlingStrategy":"validation","validationCode":"async fn block_exists(url: &str, tag: &str) -> bool {\n    send_raw(url, json!({\"jsonrpc\":\"2.0\",\"method\":\"eth_getBlockByNumber\",\"params\":[tag,false],\"id\":1}))\n        .await.ok()\n        .map(|v| !v[\"result\"].is_null())\n        .unwrap_or(false)\n}","typeGuard":null,"tryCatchPattern":"match client.block_by_tag(tag, full).await {\n    Ok(b) => Ok(b),\n    Err(e) if e.to_string().contains(\"returned no result\") => {\n        Err(anyhow!(\"block {tag} unavailable on this node (pruned or not yet mined); use an archive node\"))\n    }\n    Err(e) => Err(e),\n}","preventionTips":["Only request heights within the node's retention window (head minus pruning depth)","Use archive endpoints for historical block lookups","Ensure finalized-tag queries run against execution nodes with a consensus client","Guard future/pending heights by clamping to eth_blockNumber first"],"tags":["rpc","ethereum","blocks","not-found"],"backgroundTag":"resource-not-found","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"}