{"record":{"id":"fa95369a0d62dcf9","repo":"vectordotdev/vector","slug":"received-chunk-with-message-id-message-id-and-se-fa9536","errorCode":null,"errorMessage":"Received chunk with message id {message_id} and sequence number {sequence_number} has a sequence number greater than its total chunks value of {total_chunks}","messagePattern":"Received chunk with message id (.+?) and sequence number (.+?) has a sequence number greater than its total chunks value of (.+?)","errorType":"error_code","errorClass":"ChunkedGelfDecoderError::InvalidSequenceNumber","httpStatus":null,"severity":"error","filePath":"lib/codecs/src/decoding/framing/chunked_gelf.rs","lineNumber":427,"sourceCode":"        ensure!(\n            chunk.remaining() >= 10,\n            InvalidChunkHeaderSnafu { header: chunk }\n        );\n\n        let message_id = chunk.get_u64();\n        let sequence_number = chunk.get_u8();\n        let total_chunks = chunk.get_u8();\n\n        ensure!(\n            total_chunks > 0 && total_chunks <= GELF_MAX_TOTAL_CHUNKS,\n            InvalidTotalChunksSnafu {\n                message_id,\n                sequence_number,\n                total_chunks\n            }\n        );\n\n        ensure!(\n            sequence_number < total_chunks,\n            InvalidSequenceNumberSnafu {\n                message_id,\n                sequence_number,\n                total_chunks\n            }\n        );\n\n        let chunk_len = chunk.len();\n\n        // A lone chunk is already complete, but it cannot reuse the ID of a pending message.\n        if total_chunks == 1 {\n            if chunk_len > self.max_length {\n                return Err(ChunkedGelfDecoderError::MaxLengthExceed {\n                    message_id,\n                    sequence_number,\n                    length: chunk_len,\n                    max_length: self.max_length,","sourceCodeStart":409,"sourceCodeEnd":445,"githubUrl":"https://github.com/vectordotdev/vector/blob/bdb87aeaa4c4ff27c0ba643c1c77b21bf2ef4013/lib/codecs/src/decoding/framing/chunked_gelf.rs#L409-L445","documentation":"GELF chunk sequence numbers are 0-indexed, so every chunk must satisfy `sequence_number < total_chunks`. When a chunk arrives whose sequence number is greater than or equal to the declared total (e.g. sequence 5 of a 4-chunk message), `decode_chunk` rejects it with this error identifying the message id and both values. Such a chunk cannot belong to a coherent message reassembly.","triggerScenarios":"A datagram passes header length and total-chunks validation, but its sequence-number byte is >= the total-chunks byte — produced by senders numbering chunks from 1 instead of 0, or emitting more chunks than declared.","commonSituations":"A custom GELF client implementing 1-based sequence numbering against receivers expecting 0-based; a sender that splits the payload into more chunks than it wrote into the header; packet duplication/corruption altering header bytes.","solutions":["Fix the sender to number chunks 0-based: first chunk has sequence 0, last has sequence total-1.","Ensure the sender's declared total in byte 9 matches the actual number of chunks it transmits.","Use the message id from the error to locate the offending producer and inspect its chunking loop for off-by-one errors."],"exampleFix":"// before: 1-based sequence numbers\nfor (i, part) in parts.iter().enumerate() {\n    chunk[8] = (i + 1) as u8; // last seq == total -> error\n}\n\n// after: 0-based per GELF spec\nfor (i, part) in parts.iter().enumerate() {\n    chunk[8] = i as u8; // 0..total-1\n}","handlingStrategy":"validation","validationCode":"// sender-side guard\nfor (i, part) in parts.iter().enumerate() {\n    assert!(i < total as usize, \"sequence must be 0-based and < total\");\n    chunk[8] = i as u8;\n    chunk[9] = total as u8;\n    send(chunk_header_with(part));\n}","typeGuard":null,"tryCatchPattern":"match framing.decode(&datagram) {\n    Err(e) if e.to_string().contains(\"sequence number greater than\") => {\n        error!(\"sender uses 1-based sequence numbers or miscounted chunks: {e}\");\n    }\n    other => { /* handle normally */ }\n}","preventionTips":["Number GELF chunks 0-based: sequence ranges 0..total-1.","Ensure the declared total matches the number of chunks actually sent.","Add an off-by-one test (sequence == total must be rejected/never produced)."],"tags":["gelf","udp","codecs","framing","rust"],"backgroundTag":"value-out-of-range","analyzedSha":"bdb87aeaa4c4ff27c0ba643c1c77b21bf2ef4013","analyzedAt":"2026-09-16T02:53:35.741Z","contentChangedAt":"2026-09-16T02:53:35.741Z","schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}