thanos-io/thanos · error

proto: wrong wireType =

Error message

proto: wrong wireType = %d for field Symbols

What it means

In the remote-write v2 Request Unmarshal, field 4 (Symbols) is a length-delimited string (wire type 2). If the bytes declare a different wire type for that field, the decoder returns this error because the schema cannot be satisfied.

Solutions

  1. Align both ends on the same final remote-write v2 proto definition (regenerate from the current prometheus/prometheus prompb)
  2. Check the sender's remote-write version header and reject mismatches
  3. Re-serialize the request with the receiver's expected schema
  4. Inspect raw bytes with protoc --decode_raw to confirm the wire layout

Example fix

// before: decoding with mismatched generated code
err := req.Unmarshal(body) // req generated from old draft schema
// after: regenerate prompb v2 from current spec
goji run protoc --go_out=. io/prometheus/write/v2/types.proto
Defensive patterns

Strategy: validation

Try / catch

if err := req.Unmarshal(body); err != nil { return http.StatusBadRequest }

Prevention

When it happens

Trigger: Unmarshal called on bytes where the tag for field 4 carries a non-2 wire type — produced by a mismatched schema version (Symbols renumbered between draft versions of remote-write v2), or by corrupt input.

Common situations: Version skew between remote-write v2 draft implementations (the spec changed field numbering during development), sender and receiver generated from different .proto files, corrupted payloads.

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

Appendix: source

Thrown at pkg/store/storepb/prompb/io/prometheus/write/v2/custom.go:43

			b := dAtA[iNdEx]
			iNdEx++
			wire |= uint64(b&0x7F) << shift
			if b < 0x80 {
				break
			}
		}
		fieldNum := int32(wire >> 3)
		wireType := int(wire & 0x7)
		if wireType == 4 {
			return fmt.Errorf("proto: Request: wiretype end group for non-group")
		}
		if fieldNum <= 0 {
			return fmt.Errorf("proto: Request: illegal tag %d (wire type %d)", fieldNum, wire)
		}
		switch fieldNum {
		case 4:
			if wireType != 2 {
				return fmt.Errorf("proto: wrong wireType = %d for field Symbols", wireType)
			}
			var stringLen uint64
			for shift := uint(0); ; shift += 7 {
				if shift >= 64 {
					return ErrIntOverflowTypes
				}
				if iNdEx >= l {
					return io.ErrUnexpectedEOF
				}
				b := dAtA[iNdEx]
				iNdEx++
				stringLen |= uint64(b&0x7F) << shift
				if b < 0x80 {
					break
				}
			}
			intStringLen := int(stringLen)
			if intStringLen < 0 {

View on GitHub (pinned to 35b8b99117)