{"record":{"id":"2a4fc5ddc6a2bc4a","repo":"thanos-io/thanos","slug":"unsupported-chunk-type-v","errorCode":null,"errorMessage":"unsupported chunk type %v","messagePattern":"unsupported chunk type (.+?)","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"pkg/store/postings_codec.go","lineNumber":349,"sourceCode":"\t\t\treturn false\n\t\t}\n\n\t\t// NOTE(GiedriusS): we can probably optimize this better but this should be rare enough\n\t\t// and not cause any problems.\n\t\tif len(remainder) > 0 {\n\t\t\tremainderCopy := make([]byte, 0, len(remainder))\n\t\t\tremainderCopy = append(remainderCopy, remainder...)\n\t\t\tremainder = remainderCopy\n\t\t}\n\n\t\tif len(remainder) > 0 {\n\t\t\tit.db.B = append(remainder, uncompressedData...)\n\t\t} else {\n\t\t\tit.db.B = uncompressedData\n\t\t}\n\tdefault:\n\t\tif chunkType <= 0x7f {\n\t\t\tit.err = fmt.Errorf(\"unsupported chunk type %v\", chunkType)\n\t\t\treturn false\n\t\t}\n\t\tif chunkType > 0xfd {\n\t\t\tit.err = fmt.Errorf(\"invalid chunk type %v\", chunkType)\n\t\t\treturn false\n\t\t}\n\t}\n\tit.input = it.input[chunkLen:]\n\n\treturn true\n}\n\nfunc (it *streamedDiffVarintPostings) Next() bool {\n\t// Continue reading next chunks until there is at least binary.MaxVarintLen64.\n\t// If we cannot add any more chunks then return false.\n\tfor {\n\t\tval := it.db.Uvarint64()\n\t\tif it.db.Err() != nil {","sourceCodeStart":331,"sourceCodeEnd":367,"githubUrl":"https://github.com/thanos-io/thanos/blob/35b8b991177def87ed52dcf10f9b6d87f07282c8/pkg/store/postings_codec.go#L331-L367","documentation":"The chunk header byte (chunkType) had a value <= 0x7f, which is outside the reserved set of defined chunk types (compressed data, uncompressed data, identifier). The format deliberately leaves values 0x80-0xfd for future Snappy-chunk compatibility; anything <= 0x7f means the framing is not a valid Snappy-style postings stream, so the iterator reports this error.","triggerScenarios":"Next() reads a chunk whose first byte is <= 0x7f — the buffer is not postings-codec data at all, the offset is wrong, or the data was written by an incompatible encoder.","commonSituations":"Pointing a decoder at non-postings binary data (e.g. an index-section offset error), truncated files where a length byte is misread as a chunk type, or custom block tooling that writes invalid chunk types.","solutions":["Verify the byte slice passed to the decoder is a complete postings blob with the correct codec header; check upstream offset arithmetic.","Restore or re-generate the postings data — the stream is malformed.","Check that the writer version and reader version use the same postings codec.","Inspect the first bytes of the buffer (hexdump) to confirm it starts with the expected snappy identifier framing."],"exampleFix":null,"handlingStrategy":"validation","validationCode":"if len(blob) > 0 && blob[0] <= 0x7f && !bytes.HasPrefix(blob, []byte(\"sNaPpY\")) {\n    return fmt.Errorf(\"buffer is not a snappy-framed postings stream\")\n}","typeGuard":"func looksLikePostingsBlob(b []byte) bool {\n    return len(b) > 6 && bytes.HasPrefix(b, []byte(\"sNaPpY\"))\n}","tryCatchPattern":null,"preventionTips":["Confirm slice offsets feeding the decoder (index-file section math).","Hexdump the first bytes when decoding unknown binary data.","Regenerate malformed blocks instead of patching bytes."],"tags":["go","postings","codec","corruption"],"backgroundTag":"invalid-enum-value","analyzedSha":"35b8b991177def87ed52dcf10f9b6d87f07282c8","analyzedAt":"2026-09-07T01:49:59.689Z","contentChangedAt":"2026-09-07T01:49:59.689Z","schemaVersion":2},"datasetVersion":"2026-09-15T23:17:13.987Z"}