thanos-io/thanos · error

proto: wrong wireType =

Error message

proto: wrong wireType = %d for field MinTime

What it means

Generated gogoproto Unmarshal guard for field 4 (MinTime) of the Statistic message in pkg/status/statuspb/rpc.pb.go:1766. MinTime is an int64 encoded as a varint; the error fires when the wire payload encodes field 4 with a different wire type, so the bytes cannot match the compiled schema.

Solutions

  1. Use identical Thanos versions and statuspb generated code on both peers
  2. Regenerate rpc.pb.go from the current rpc.proto with matching toolchain versions
  3. Verify MinTime is field 4 (varint) in the sender's schema
  4. Inspect raw wire bytes with grpclog/proxy tooling to confirm what the sender actually encoded

Example fix

// before: sender uses custom/older proto
res.Marshal() // field types differ
// after: both sides import the same statuspb package
res := &statuspb.TSDBStatisticsResponse{Statistics: stats}
buf, _ := res.Marshal()
Defensive patterns

Strategy: try-catch

Validate before calling

if !semverCompatible(peerVersion, minSupportedVersion) {
    return fmt.Errorf("peer %s version %s incompatible for TSDB statistics", peer, peerVersion)
}

Try / catch

if err := proto.Unmarshal(buf, &stat); err != nil {
    if strings.Contains(err.Error(), "field MinTime") {
        return fmt.Errorf("schema mismatch (MinTime): %w", err)
    }
    return err
}

Prevention

When it happens

Trigger: Unmarshaling a Statistic message where field 4 arrives with wire type 1, 2, or 5 instead of 0 (varint), i.e. the sender's schema or codec differs from the receiver's generated code.

Common situations: Version skew between Thanos components; message produced by a different protobuf generator that assigned different types/field numbers; corrupted or truncated gRPC stream frames.

Understand the failure class

Background: "cannot parse invalid wire-format data", "cannot unmarshal", "failed unmarshalling": protobuf unmarshal errors explained — this error's family across 10 libraries.

Related errors


AI-assisted analysis of thanos-io/thanos@35b8b99117 (2026-09-07). Data as JSON: /api/errors/76e4b2c0ef2780a3. Report an issue: GitHub.

Appendix: source

Thrown at pkg/status/statuspb/rpc.pb.go:1766

			}
			m.ChunkCount = 0
			for shift := uint(0); ; shift += 7 {
				if shift >= 64 {
					return ErrIntOverflowRpc
				}
				if iNdEx >= l {
					return io.ErrUnexpectedEOF
				}
				b := dAtA[iNdEx]
				iNdEx++
				m.ChunkCount |= int64(b&0x7F) << shift
				if b < 0x80 {
					break
				}
			}
		case 4:
			if wireType != 0 {
				return fmt.Errorf("proto: wrong wireType = %d for field MinTime", wireType)
			}
			m.MinTime = 0
			for shift := uint(0); ; shift += 7 {
				if shift >= 64 {
					return ErrIntOverflowRpc
				}
				if iNdEx >= l {
					return io.ErrUnexpectedEOF
				}
				b := dAtA[iNdEx]
				iNdEx++
				m.MinTime |= int64(b&0x7F) << shift
				if b < 0x80 {
					break
				}
			}
		case 5:
			if wireType != 0 {

View on GitHub (pinned to 35b8b99117)