{"record":{"id":"b659c7613fda0080","repo":"FuelLabs/fuel-core","slug":"failed-to-fetch-latest-block-height-err","errorCode":null,"errorMessage":"Failed to fetch latest block height: {err}","messagePattern":"Failed to fetch latest block height: (.+?)","errorType":"exception","errorClass":"anyhow::Error","httpStatus":null,"severity":"error","filePath":"crates/services/shared-sequencer/src/lib.rs","lineNumber":125,"sourceCode":"            http,\n        })\n    }\n\n    /// Returns the Cosmos account ID of the sender.\n    pub fn sender_account_id<S: Signer>(&self, signer: &S) -> anyhow::Result<AccountId> {\n        let sender_public_key = signer.public_key();\n        let sender_account_id = sender_public_key\n            .account_id(&self.account_prefix)\n            .map_err(|err| anyhow!(\"{err:?}\"))?;\n\n        Ok(sender_account_id)\n    }\n\n    /// Retrieve latest block height\n    pub async fn latest_block_height(&self) -> anyhow::Result<u32> {\n        http_api::latest_block_height(&self.http, &self.endpoints.tendermint_rpc_api)\n            .await\n            .map_err(|err| anyhow!(\"Failed to fetch latest block height: {err}\"))\n    }\n\n    /// Retrieve account metadata by its ID\n    pub async fn get_account_meta<S: Signer>(\n        &self,\n        signer: &S,\n    ) -> anyhow::Result<AccountMetadata> {\n        let sender_account_id = self.sender_account_id(signer)?;\n        http_api::get_account(\n            &self.http,\n            &self.endpoints.blockchain_rest_api,\n            sender_account_id,\n        )\n        .await\n    }\n\n    /// Retrieve the topic info, if it exists\n    pub async fn get_topic(&self) -> anyhow::Result<Option<TopicInfo>> {","sourceCodeStart":107,"sourceCodeEnd":143,"githubUrl":"https://github.com/FuelLabs/fuel-core/blob/add100d30d21498e8528c46be8567fbd2ea019af/crates/services/shared-sequencer/src/lib.rs#L107-L143","documentation":"`Importer::latest_block_height` queries the Tendermint RPC endpoint (`abci_info` JSON-RPC call via `http_api::latest_block_height`) and wraps any failure with the context \"Failed to fetch latest block height\". The inner `err` is either a reqwest network error, a non-success RPC response, or a parse error of `last_block_height`. It indicates the shared sequencer could not read the current Celestia/Tendermint chain height.","triggerScenarios":"`latest_block_height()` (called from `send`) fails when: the configured `tendermint_rpc_api` URL is unreachable or wrong, the HTTP request times out or returns a transport error, the JSON-RPC response shape is unexpected, or `last_block_height` cannot be parsed as an integer.","commonSituations":"Misconfigured or missing `--tendermint-rpc-api` endpoint; Celestia/Tendermint node down or restarting; wrong port, TLS, or reverse-proxy setup; RPC rate limiting or firewall blocking the node; a Tendermint version returning an incompatible `abci_info` payload.","solutions":["Verify the `tendermint_rpc_api` endpoint URL and that the Tendermint/Celestia node is reachable: `curl <url> -X POST -d '{\"jsonrpc\":\"2.0\",\"method\":\"abci_info\",\"id\":1}'`.","Fix network-level issues: correct host/port, firewall rules, and ensure the sequencer node is fully synced and serving RPC.","Increase HTTP timeouts or add retry with backoff around `latest_block_height` for transient RPC outages.","If parsing fails, check the Tendermint version's `abci_info` response shape and upgrade the shared-sequencer config/code to match."],"exampleFix":"// before\nlet height = importer.latest_block_height().await?;\n// after\nlet height = match importer.latest_block_height().await {\n    Ok(h) => h,\n    Err(e) => {\n        tracing::warn!(\"tendermint RPC unreachable, retrying: {e:#}\");\n        tokio::time::sleep(Duration::from_secs(2)).await;\n        importer.latest_block_height().await?\n    }\n};","handlingStrategy":"retry","validationCode":"// pre-flight: confirm the Tendermint RPC answers before using the sequencer\nlet ok = reqwest::Client::new()\n    .post(tendermint_rpc_api)\n    .json(&serde_json::json!({\"jsonrpc\":\"2.0\",\"method\":\"abci_info\",\"params\":{},\"id\":1}))\n    .timeout(Duration::from_secs(5))\n    .send().await\n    .map(|r| r.status().is_success())\n    .unwrap_or(false);\nif !ok { return Err(anyhow!(\"Tendermint RPC endpoint unreachable: {tendermint_rpc_api}\")); }","typeGuard":"fn is_rpc_reachability_error(err: &anyhow::Error) -> bool {\n    err.chain().any(|c| {\n        c.downcast_ref::<reqwest::Error>().is_some()\n            || c.to_string().contains(\"error sending request\")\n            || c.to_string().contains(\"timed out\")\n    })\n}","tryCatchPattern":"match sequencer.latest_block_height().await {\n    Ok(h) => h,\n    Err(e) if is_rpc_reachability_error(&e) => {\n        // transient: retry with backoff\n        backoff(|| sequencer.latest_block_height().await).await?\n    }\n    Err(e) => return Err(e.context(\"non-transient tendermint RPC failure\")),\n}","preventionTips":["Validate the `tendermint_rpc_api` URL in config at startup with a health-check call.","Set explicit reqwest timeouts and retry with exponential backoff for RPC calls.","Monitor Tendermint node uptime and sync status alongside the sequencer.","Pin a Tendermint version whose `abci_info` response matches the parser, and test after upgrades."],"tags":["network","http","tendermint","rpc","celestia"],"backgroundTag":"rpc-request-failed","analyzedSha":"add100d30d21498e8528c46be8567fbd2ea019af","analyzedAt":"2026-09-05T18:46:12.018Z","contentChangedAt":"2026-09-05T18:46:12.018Z","schemaVersion":2},"datasetVersion":"2026-09-14T05:17:10.506Z"}