thanos-io/thanos · error
proto: wrong wireType =
Error message
proto: wrong wireType = %d for field ChunkCount
What it means
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.
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
Example fix
// before: receiver compiled with stale rpc.proto // after: regenerate and rebuild both sides make proto go build ./pkg/status/...
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 ChunkCount") {
return fmt.Errorf("schema mismatch (ChunkCount): %w", err)
}
return err
} Prevention
- 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
When it happens
Trigger: Unmarshaling a Statistic message where field 3 is received as length-delimited (2), fixed64 (1), or fixed32 (5) instead of varint (0).
Common situations: 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.
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
- proto: wrong wireType =
- proto: wrong wireType =
- proto: wrong wireType =
- proto: wrong wireType =
- proto: wrong wireType =
AI-assisted analysis of thanos-io/thanos@35b8b99117 (2026-09-07).
Data as JSON: /api/errors/b6974178ca63e0b5.
Report an issue: GitHub.
Appendix: source
Thrown at pkg/status/statuspb/rpc.pb.go:1747
}
m.NumLabelPairs = 0
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowRpc
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
m.NumLabelPairs |= int64(b&0x7F) << shift
if b < 0x80 {
break
}
}
case 3:
if wireType != 0 {
return fmt.Errorf("proto: wrong wireType = %d for field ChunkCount", wireType)
}
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 {View on GitHub (pinned to 35b8b99117)