{"record":{"id":"b6974178ca63e0b5","repo":"thanos-io/thanos","slug":"proto-wrong-wiretype-d-for-field-chunkcount","errorCode":null,"errorMessage":"proto: wrong wireType = %d for field ChunkCount","messagePattern":"proto: wrong wireType = (.+?) for field ChunkCount","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"pkg/status/statuspb/rpc.pb.go","lineNumber":1747,"sourceCode":"\t\t\t}\n\t\t\tm.NumLabelPairs = 0\n\t\t\tfor shift := uint(0); ; shift += 7 {\n\t\t\t\tif shift >= 64 {\n\t\t\t\t\treturn ErrIntOverflowRpc\n\t\t\t\t}\n\t\t\t\tif iNdEx >= l {\n\t\t\t\t\treturn io.ErrUnexpectedEOF\n\t\t\t\t}\n\t\t\t\tb := dAtA[iNdEx]\n\t\t\t\tiNdEx++\n\t\t\t\tm.NumLabelPairs |= int64(b&0x7F) << shift\n\t\t\t\tif b < 0x80 {\n\t\t\t\t\tbreak\n\t\t\t\t}\n\t\t\t}\n\t\tcase 3:\n\t\t\tif wireType != 0 {\n\t\t\t\treturn fmt.Errorf(\"proto: wrong wireType = %d for field ChunkCount\", wireType)\n\t\t\t}\n\t\t\tm.ChunkCount = 0\n\t\t\tfor shift := uint(0); ; shift += 7 {\n\t\t\t\tif shift >= 64 {\n\t\t\t\t\treturn ErrIntOverflowRpc\n\t\t\t\t}\n\t\t\t\tif iNdEx >= l {\n\t\t\t\t\treturn io.ErrUnexpectedEOF\n\t\t\t\t}\n\t\t\t\tb := dAtA[iNdEx]\n\t\t\t\tiNdEx++\n\t\t\t\tm.ChunkCount |= int64(b&0x7F) << shift\n\t\t\t\tif b < 0x80 {\n\t\t\t\t\tbreak\n\t\t\t\t}\n\t\t\t}\n\t\tcase 4:\n\t\t\tif wireType != 0 {","sourceCodeStart":1729,"sourceCodeEnd":1765,"githubUrl":"https://github.com/thanos-io/thanos/blob/35b8b991177def87ed52dcf10f9b6d87f07282c8/pkg/status/statuspb/rpc.pb.go#L1729-L1765","documentation":"Same generated gogoproto Unmarshal guard as error 932, but for field 3 (ChunkCount) of the Statistic message in pkg/status/statuspb/rpc.pb.go:1747. It fires when the incoming wire bytes encode ChunkCount with a non-varint wire type, proving a schema/codec mismatch between sender and receiver.","triggerScenarios":"Unmarshaling a Statistic message where field 3 is received as length-delimited (2), fixed64 (1), or fixed32 (5) instead of varint (0).","commonSituations":"Thanos component version skew; receiver's generated rpc.pb.go out of date relative to the sender's proto; interop with a non-Thanos service that reuses field numbers differently.","solutions":["Align both peers on the same Thanos version / generated statuspb code","Regenerate pkg/status/statuspb with matching protoc and gogoproto versions","Confirm ChunkCount is field 3 with proto type varint in the sender's rpc.proto","Capture and inspect the raw gRPC frame if the mismatch persists after version alignment"],"exampleFix":"// before: receiver compiled with stale rpc.proto\n// after: regenerate and rebuild both sides\nmake proto\ngo build ./pkg/status/...","handlingStrategy":"try-catch","validationCode":"if !semverCompatible(peerVersion, minSupportedVersion) {\n    return fmt.Errorf(\"peer %s version %s incompatible for TSDB statistics\", peer, peerVersion)\n}","typeGuard":null,"tryCatchPattern":"if err := proto.Unmarshal(buf, &stat); err != nil {\n    if strings.Contains(err.Error(), \"field ChunkCount\") {\n        return fmt.Errorf(\"schema mismatch (ChunkCount): %w\", err)\n    }\n    return err\n}","preventionTips":["Pin component versions together during upgrades","Run proto conformance tests between build artifacts","Avoid mixing gogo/golang protobuf generated code for the same message","Log peer build version on every RPC"],"tags":["protobuf","grpc","deserialization","wire-format","gogoproto"],"backgroundTag":"protobuf-unmarshal-failed","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"}