{"record":{"id":"ebb3d46e6e0515a2","repo":"thanos-io/thanos","slug":"proto-wrong-wiretype-d-for-field-timeseries","errorCode":null,"errorMessage":"proto: wrong wireType = %d for field Timeseries","messagePattern":"proto: wrong wireType = (.+?) for field Timeseries","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"pkg/store/storepb/prompb/io/prometheus/write/v2/custom.go","lineNumber":75,"sourceCode":"\t\t\t\t\tbreak\n\t\t\t\t}\n\t\t\t}\n\t\t\tintStringLen := int(stringLen)\n\t\t\tif intStringLen < 0 {\n\t\t\t\treturn ErrInvalidLengthTypes\n\t\t\t}\n\t\t\tpostIndex := iNdEx + intStringLen\n\t\t\tif postIndex < 0 {\n\t\t\t\treturn ErrInvalidLengthTypes\n\t\t\t}\n\t\t\tif postIndex > l {\n\t\t\t\treturn io.ErrUnexpectedEOF\n\t\t\t}\n\t\t\tm.Symbols = append(m.Symbols, unsafe.String(unsafe.SliceData(dAtA[iNdEx:postIndex]), len(dAtA[iNdEx:postIndex])))\n\t\t\tiNdEx = postIndex\n\t\tcase 5:\n\t\t\tif wireType != 2 {\n\t\t\t\treturn fmt.Errorf(\"proto: wrong wireType = %d for field Timeseries\", wireType)\n\t\t\t}\n\t\t\tvar msglen int\n\t\t\tfor shift := uint(0); ; shift += 7 {\n\t\t\t\tif shift >= 64 {\n\t\t\t\t\treturn ErrIntOverflowTypes\n\t\t\t\t}\n\t\t\t\tif iNdEx >= l {\n\t\t\t\t\treturn io.ErrUnexpectedEOF\n\t\t\t\t}\n\t\t\t\tb := dAtA[iNdEx]\n\t\t\t\tiNdEx++\n\t\t\t\tmsglen |= int(b&0x7F) << shift\n\t\t\t\tif b < 0x80 {\n\t\t\t\t\tbreak\n\t\t\t\t}\n\t\t\t}\n\t\t\tif msglen < 0 {\n\t\t\t\treturn ErrInvalidLengthTypes","sourceCodeStart":57,"sourceCodeEnd":93,"githubUrl":"https://github.com/thanos-io/thanos/blob/35b8b991177def87ed52dcf10f9b6d87f07282c8/pkg/store/storepb/prompb/io/prometheus/write/v2/custom.go#L57-L93","documentation":"Field 5 (Timeseries) in remote-write v2 Request is a repeated message, which must be length-delimited (wire type 2). The custom Unmarshal returns this error when the bytes use another wire type for it, i.e. the stream does not conform to the schema.","triggerScenarios":"Unmarshal on a payload where field 5 is encoded as varint/fixed instead of length-delimited — schema mismatch between sender and receiver, byte corruption, or wrong message type decoded.","commonSituations":"Sender built from a different prompb version, intermediary transforming the body, corrupted transfer, or hand-written test data with wrong encoding.","solutions":["Regenerate both sides from the same types.proto so Timeseries is field 5, wire type 2","Validate payload with protoc --decode_raw before decoding","Re-send the request after fixing the encoder","Check for proxies/middleware altering request bodies"],"exampleFix":"// before: mixed schema versions\nsenderReq.Marshal() // old schema\n// after: pin both services to the same generated package version\nrequire github.com/prometheus/prometheus/prompb/io/prometheus/write/v2 v0.x.y (same in sender & receiver)","handlingStrategy":"validation","validationCode":null,"typeGuard":null,"tryCatchPattern":"if err := req.Unmarshal(body); err != nil { return errors.Wrap(err, \"rw2 decode\") }","preventionTips":["Ensure encoder and decoder generate from the identical .proto file","Avoid middleware that mutates protobuf bodies","Use round-trip tests in CI for the v2 write path"],"tags":["protobuf","unmarshal","wire-format","remote-write"],"backgroundTag":"protobuf-unmarshal-failed","analyzedSha":"35b8b991177def87ed52dcf10f9b6d87f07282c8","analyzedAt":"2026-09-07T01:49:59.689Z","contentChangedAt":"2026-09-07T01:49:59.689Z","schemaVersion":2},"datasetVersion":"2026-09-15T23:17:13.987Z"}