thanos-io/thanos · error

proto: wrong wireType =

Error message

proto: wrong wireType = %d for field Value

What it means

Generated gogoproto Unmarshal guard for field 2 (Value) of the Statistic message in pkg/status/statuspb/rpc.pb.go:1886. Value is a numeric field encoded as varint; the error fires when field 2 arrives with any other wire type, meaning the incoming bytes do not match the compiled schema.

Solutions

  1. Use the same Thanos version and generated statuspb code on both peers
  2. Regenerate rpc.pb.go from the canonical rpc.proto
  3. Confirm Value is field 2 with a varint proto type in the sender's schema
  4. Inspect raw wire frames if the mismatch persists after version alignment

Example fix

// before: stale generated code on receiver
go mod tidy // pulls mismatched statuspb
// after
make proto && go mod tidy && go build ./...
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 Value") {
        return fmt.Errorf("schema mismatch (Value): %w", err)
    }
    return err
}

Prevention

When it happens

Trigger: Unmarshaling a Statistic message where field 2 arrives with wire type 2, 1, or 5 instead of varint (0), typically when sender and receiver schemas differ.

Common situations: Thanos component version mismatch; receiver's generated rpc.pb.go stale versus the sender's proto; corrupted gRPC streams or interop with a non-conforming encoder.

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/34dda9188ea760b4. Report an issue: GitHub.

Appendix: source

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

					break
				}
			}
			intStringLen := int(stringLen)
			if intStringLen < 0 {
				return ErrInvalidLengthRpc
			}
			postIndex := iNdEx + intStringLen
			if postIndex < 0 {
				return ErrInvalidLengthRpc
			}
			if postIndex > l {
				return io.ErrUnexpectedEOF
			}
			m.Name = string(dAtA[iNdEx:postIndex])
			iNdEx = postIndex
		case 2:
			if wireType != 0 {
				return fmt.Errorf("proto: wrong wireType = %d for field Value", wireType)
			}
			m.Value = 0
			for shift := uint(0); ; shift += 7 {
				if shift >= 64 {
					return ErrIntOverflowRpc
				}
				if iNdEx >= l {
					return io.ErrUnexpectedEOF
				}
				b := dAtA[iNdEx]
				iNdEx++
				m.Value |= uint64(b&0x7F) << shift
				if b < 0x80 {
					break
				}
			}
		default:
			iNdEx = preIndex

View on GitHub (pinned to 35b8b99117)