{"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":1462,"sourceCode":"                    .await;\n                Err(anyhow!(\n                    \"Timed out reading latest stream entry from Redis node\"\n                ))\n            }\n            Ok(Err(e)) => {\n                RedisLeaderLeaseAdapter::clear_cached_connection_for(&self.redis_node)\n                    .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\n/// RAII guard that increments `poa_outstanding_publish_tasks` on\n/// construction and decrements on drop. Constructed in the parent of\n/// `publish_block_on_all_nodes` (so the gauge counts the task from the\n/// instant it is queued) and moved into the spawn closure (so the\n/// decrement runs whether the task completes normally, panics inside\n/// the closure, or is cancelled mid-await).\nstruct OutstandingPublishTaskGuard;\n\nimpl OutstandingPublishTaskGuard {\n    fn new() -> Self {\n        poa_metrics().outstanding_publish_tasks.inc();\n        Self","sourceCodeStart":1444,"sourceCodeEnd":1480,"githubUrl":"https://github.com/FuelLabs/fuel-core/blob/add100d30d21498e8528c46be8567fbd2ea019af/crates/fuel-core/src/service/adapters/consensus_module/poa.rs#L1444-L1480","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":"add100d30d21498e8528c46be8567fbd2ea019af","analyzedAt":"2026-09-05T18:46:12.018Z","contentChangedAt":"2026-09-05T18:46:12.018Z","schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}