{"record":{"id":"909aa94bdb59d5b2","repo":"FuelLabs/fuel-core","slug":"failed-to-read-latest-stream-entry-from-redis-node","errorCode":null,"errorMessage":"Failed to read latest stream entry from Redis node: {e}","messagePattern":"Failed to read latest stream entry from Redis node: (.+?)","errorType":"exception","errorClass":"anyhow::Error","httpStatus":null,"severity":"error","filePath":"crates/fuel-core/src/service/adapters/consensus_module/poa.rs","lineNumber":627,"sourceCode":"    ) -> anyhow::Result<Option<(u32, String)>> {\n        let mut connection = self.multiplexed_connection(redis_node).await?;\n        let latest_entry = timeout(\n            self.node_timeout,\n            redis::Script::new(READ_LATEST_STREAM_ENTRY_SCRIPT)\n                .key(&self.block_stream_key)\n                .invoke_async::<Vec<String>>(&mut connection),\n        )\n        .await;\n        match latest_entry {\n            Err(_) => {\n                self.clear_cached_connection(redis_node).await;\n                Err(anyhow!(\n                    \"Timed out reading latest stream entry from Redis node\"\n                ))\n            }\n            Ok(Err(e)) => {\n                self.clear_cached_connection(redis_node).await;\n                Err(anyhow!(\n                    \"Failed to read latest stream entry from Redis node: {e}\"\n                ))\n            }\n            Ok(Ok(entry)) => {\n                if entry.len() != 2 {\n                    return Ok(None);\n                }\n                let height = entry[0]\n                    .parse::<u32>()\n                    .map_err(|e| anyhow!(\"Invalid latest stream entry height: {e}\"))?;\n                Ok(Some((height, entry[1].clone())))\n            }\n        }\n    }\n\n    async fn should_reconcile_from_stream(\n        &self,\n        next_height: BlockHeight,","sourceCodeStart":609,"sourceCodeEnd":645,"githubUrl":"https://github.com/FuelLabs/fuel-core/blob/b9d4d170da3a31c9ace5f963d633b326348e0d42/crates/fuel-core/src/service/adapters/consensus_module/poa.rs#L609-L645","documentation":"Same read path (crates/fuel-core/src/service/adapters/consensus_module/poa.rs:627): the Lua script completed but Redis returned a protocol-level error, carried in {e}. The cached connection is cleared before propagating; if enough other nodes answer, quorum-based reconciliation continues without the failed node.","triggerScenarios":"Redis errors such as WRONGTYPE ({lease_key}:block:stream holds a non-stream value), MISCONF (persistence failure, read-only state), NOAUTH/ACL denials, or an in-flight connection killed server-side.","commonSituations":"Another tool overwrote the stream key with a plain string; Redis hit disk-full and entered MISCONF; credentials or ACLs changed under the node; aggressive server timeout policies dropping idle connections.","solutions":["Read the {e} cause: WRONGTYPE means the block:stream key is not a stream — remove or rename the foreign key after reviewing data loss","Fix Redis health: free disk space (MISCONF), correct ACL/credentials","Restart or replace the unhealthy node; a quorum of healthy nodes keeps the chain operating meanwhile"],"exampleFix":"# WRONGTYPE case: inspect and clear the foreign key\nredis-cli -u <url> TYPE <lease_key>:block:stream   # -> string (bad)\nredis-cli -u <url> DEL  <lease_key>:block:stream   # stream is recreated on next publish","handlingStrategy":"retry","validationCode":"// pre-flight type check per node:\nlet key_type: String = cmd(\"TYPE\").arg(&stream_key).query(&mut con)?;\nanyhow::ensure!(key_type == \"stream\", \"block:stream key is not a stream\");","typeGuard":null,"tryCatchPattern":"match read_latest(node).await {\n    Err(e) if e.to_string().contains(\"Failed to read latest stream entry\") => {\n        // inspect root cause in {e}: WRONGTYPE/MISCONF/NOAUTH each have a distinct fix;\n        // exclude node this round, alert if quorum margin is gone\n    }\n    other => other,\n}","preventionTips":["Grant the leader-lock Redis user only the permissions it needs; lock down the key prefix so foreign tools cannot overwrite it","Alert on Redis MISCONF/OOM server-side conditions before they surface here","Never point unrelated writers at the lease_key namespace"],"tags":["fuel-core","redis","stream","protocol","operations"],"backgroundTag":null,"analyzedSha":"b9d4d170da3a31c9ace5f963d633b326348e0d42","analyzedAt":"2026-08-16T08:56:42.692Z","schemaVersion":2},"datasetVersion":"2026-08-16T13:17:31.715Z"}