thanos-io/thanos · error
proto: wrong wireType =
Error message
proto: wrong wireType = %d for field MaxTime
What it means
Generated gogoproto Unmarshal guard for field 5 (MaxTime) of the Statistic message in pkg/status/statuspb/rpc.pb.go:1785. Like MinTime, MaxTime must be varint-encoded; the error fires when field 5 arrives with any other wire type, indicating the wire data does not match the compiled schema.
Solutions
- Pin both client and server to the same Thanos version so the schema matches
- Regenerate the statuspb package from the canonical rpc.proto
- Confirm MaxTime is field 5 (varint) in the sender's schema
- Log the raw gRPC payload to identify exactly what the sender encoded
Example fix
// before: mixed versions querier (v0.30) -> store (v0.32) // after querier and store upgraded to the same release
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 MaxTime") {
return fmt.Errorf("schema mismatch (MaxTime): %w", err)
}
return err
} Prevention
- Keep sender and receiver schemas in lockstep
- Re-generate *.pb.go whenever rpc.proto changes
- Round-trip test every message type in CI
- Fail fast on peer version skew at startup
When it happens
Trigger: Unmarshaling a Statistic message where field 5 arrives with wire type 1, 2, or 5 instead of varint (0).
Common situations: Thanos component version mismatch; sender generated from a modified rpc.proto; proxy or service mesh mangling gRPC frames; interop with a hand-written protobuf 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
- 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/cb8d16c35e8d41d9.
Report an issue: GitHub.
Appendix: source
Thrown at pkg/status/statuspb/rpc.pb.go:1785
}
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 {
return fmt.Errorf("proto: wrong wireType = %d for field MaxTime", wireType)
}
m.MaxTime = 0
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowRpc
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
m.MaxTime |= int64(b&0x7F) << shift
if b < 0x80 {
break
}
}
default:
iNdEx = preIndexView on GitHub (pinned to 35b8b99117)