{"record":{"id":"2db762956d525c76","repo":"FuelLabs/fuel-core","slug":"invalid-latest-stream-entry-height-e","errorCode":null,"errorMessage":"Invalid latest stream entry height: {e}","messagePattern":"Invalid latest stream entry height: (.+?)","errorType":"exception","errorClass":"anyhow::Error","httpStatus":null,"severity":"error","filePath":"crates/fuel-core/src/service/adapters/consensus_module/poa.rs","lineNumber":637,"sourceCode":"            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,\n    ) -> anyhow::Result<bool> {\n        let next_height = u32::from(next_height);\n        let latest_results = futures::future::join_all(\n            self.redis_nodes\n                .iter()\n                .map(|redis_node| self.read_latest_stream_entry_on_node(redis_node)),\n        )\n        .await;\n        let mut successful_reads = 0usize;\n        let mut failed_count = 0usize;","sourceCodeStart":619,"sourceCodeEnd":655,"githubUrl":"https://github.com/FuelLabs/fuel-core/blob/b9d4d170da3a31c9ace5f963d633b326348e0d42/crates/fuel-core/src/service/adapters/consensus_module/poa.rs#L619-L655","documentation":"read_latest_stream_entry_on_node (crates/fuel-core/src/service/adapters/consensus_module/poa.rs:637): the Lua script returned a 2-element [height, id] result but entry[0] failed to parse as u32. Block publish writes the height field as a plain decimal height, so anything unparseable means the stream content is malformed relative to what this code expects.","triggerScenarios":"Foreign or corrupted data in the {lease_key}:block:stream stream: a different writer or record format, a partially written entry after a Redis crash, or a fuel-core version that changed the stream record layout.","commonSituations":"Mixing fuel-core versions against the same Redis and lease_key; manual writes to the stream; corrupted RDB/AOF restore artifacts.","solutions":["Inspect the offending entry with XRANGE {lease_key}:block:stream - + and identify the malformed height field","Align all fuel-core nodes to one version and one lease_key so the record format is consistent","As a last resort delete/recreate the stream once the backlog is reconciled or consciously abandoned — this forces backlog recovery from other sources"],"exampleFix":"redis-cli XRANGE <lease_key>:block:stream - + COUNT 20\n# find the entry whose first field is not a decimal height, then:\n# redis-cli XDEL <lease_key>:block:stream <entry-id>","handlingStrategy":"try-catch","validationCode":"// operator-side check that stream heights are decimal u32:\n// redis-cli XRANGE <lease_key>:block:stream - + COUNT 5\n// every entry's first field must be a plain decimal height","typeGuard":"fn is_invalid_stream_height(e: &anyhow::Error) -> bool {\n    e.to_string().contains(\"Invalid latest stream entry height\")\n}","tryCatchPattern":"match read_latest(node).await {\n    Err(e) if is_invalid_stream_height(&e) => {\n        // corrupt/foreign stream data: quarantine node, inspect with XRANGE,\n        // never rewrite data blindly — reconcile with other nodes first\n    }\n    other => other,\n}","preventionTips":["Use a unique lease_key per chain/deployment so streams are never shared","Upgrade all nodes in lockstep; do not mix fuel-core versions on one stream","Restrict write access to the Redis stream to the fuel-core user only"],"tags":["fuel-core","redis","stream","data-corruption","parsing"],"backgroundTag":null,"analyzedSha":"b9d4d170da3a31c9ace5f963d633b326348e0d42","analyzedAt":"2026-08-16T08:56:42.692Z","schemaVersion":2},"datasetVersion":"2026-08-16T13:17:31.715Z"}