{"record":{"id":"d9dd4780960a49c8","repo":"thanos-io/thanos","slug":"proto-wrong-wiretype-d-for-field-name","errorCode":null,"errorMessage":"proto: wrong wireType = %d for field Name","messagePattern":"proto: wrong wireType = (.+?) for field Name","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"pkg/status/statuspb/rpc.pb.go","lineNumber":1854,"sourceCode":"\t\t\tb := dAtA[iNdEx]\n\t\t\tiNdEx++\n\t\t\twire |= uint64(b&0x7F) << shift\n\t\t\tif b < 0x80 {\n\t\t\t\tbreak\n\t\t\t}\n\t\t}\n\t\tfieldNum := int32(wire >> 3)\n\t\twireType := int(wire & 0x7)\n\t\tif wireType == 4 {\n\t\t\treturn fmt.Errorf(\"proto: Statistic: wiretype end group for non-group\")\n\t\t}\n\t\tif fieldNum <= 0 {\n\t\t\treturn fmt.Errorf(\"proto: Statistic: illegal tag %d (wire type %d)\", fieldNum, wire)\n\t\t}\n\t\tswitch fieldNum {\n\t\tcase 1:\n\t\t\tif wireType != 2 {\n\t\t\t\treturn fmt.Errorf(\"proto: wrong wireType = %d for field Name\", wireType)\n\t\t\t}\n\t\t\tvar stringLen uint64\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\tstringLen |= uint64(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\t\tintStringLen := int(stringLen)\n\t\t\tif intStringLen < 0 {","sourceCodeStart":1836,"sourceCodeEnd":1872,"githubUrl":"https://github.com/thanos-io/thanos/blob/35b8b991177def87ed52dcf10f9b6d87f07282c8/pkg/status/statuspb/rpc.pb.go#L1836-L1872","documentation":"Generated gogoproto Unmarshal guard for field 1 (Name) of the Statistic message in pkg/status/statuspb/rpc.pb.go:1854. Name is a string and must be length-delimited (wire type 2); the error fires when field 1 arrives with a different wire type, so the wire bytes disagree with the compiled schema.","triggerScenarios":"Unmarshaling a Statistic message where field 1 arrives as varint (0), fixed64 (1), or fixed32 (5) instead of length-delimited (2).","commonSituations":"Version skew between Thanos components; sender generated from a different rpc.proto where field 1 has a different type; interop with another service reusing the same field numbers with different types.","solutions":["Build all peers from the same Thanos version so the statuspb schema matches","Regenerate pkg/status/statuspb with the protoc/gogoproto toolchain used by the sender","Verify Name is field 1, type string (wire type 2) in the sender's rpc.proto","Capture raw wire data to confirm the sender's encoding if versions already match"],"exampleFix":"// before: sender schema diverged\nmessage Statistic { int32 name = 1; }\n// after\nmessage Statistic { string name = 1; }","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 Name\") {\n        return fmt.Errorf(\"schema mismatch (Name): %w\", err)\n    }\n    return err\n}","preventionTips":["Never change a field's type without a schema-compatibility plan","Round-trip test message encode/decode between builds","Track proto changes in changelogs for operators","Detect peer version skew before making status RPCs"],"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"}