{"record":{"id":"d6d89c8ea50ed874","repo":"thanos-io/thanos","slug":"proto-wrong-wiretype-d-for-field-hash","errorCode":null,"errorMessage":"proto: wrong wireType = %d for field Hash","messagePattern":"proto: wrong wireType = (.+?) for field Hash","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"pkg/store/storepb/custom.go","lineNumber":666,"sourceCode":"\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 byteLen < 0 {\n\t\t\t\treturn ErrInvalidLengthTypes\n\t\t\t}\n\t\t\tpostIndex := iNdEx + byteLen\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.Data = dAtA[iNdEx:postIndex]\n\t\t\tiNdEx = postIndex\n\t\tcase 3:\n\t\t\tif wireType != 0 {\n\t\t\t\treturn fmt.Errorf(\"proto: wrong wireType = %d for field Hash\", wireType)\n\t\t\t}\n\t\t\tm.Hash = 0\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\tm.Hash |= uint64(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\tdefault:\n\t\t\tiNdEx = preIndex","sourceCodeStart":648,"sourceCodeEnd":684,"githubUrl":"https://github.com/thanos-io/thanos/blob/35b8b991177def87ed52dcf10f9b6d87f07282c8/pkg/store/storepb/custom.go#L648-L684","documentation":"This error comes from the hand-written gogo/golang proto Unmarshal path for a storepb message. It is thrown when the wire type of field 3 (Hash) on the wire does not match the declared type (varint, wireType 0). It means the encoded bytes being decoded are not valid protobuf for this message schema.","triggerScenarios":"Calling Unmarshal (directly or via XXX_Unmarshal) on bytes where field 3 is encoded with a non-varint wire type — e.g. the payload was produced by a different/older schema, truncated, corrupted, or misinterpreted as this message type.","commonSituations":"Version skew between Thanos components (one side has a different storepb contract), sending raw bytes of one message type to a storepb endpoint, corrupted network payloads, or manually crafted/canned test data with wrong encoding.","solutions":["Regenerate/align storepb protobuf definitions so both encoder and decoder use the same schema version","Verify the byte source: confirm the client actually serializes a storepb SeriesResponse/Chunk and not another message type","Re-encode the payload with the current proto library and retry","If data comes from disk/network, checksum and re-transfer the payload"],"exampleFix":"// before: decoding arbitrary bytes as storepb\nvar resp storepb.SeriesResponse\nresp.Unmarshal(rawBytes)\n// after: ensure the payload is produced by matching storepb types\nrespBytes, err := expectedResp.Marshal()\nif err != nil { return err }\nerr = resp.Unmarshal(respBytes)","handlingStrategy":"validation","validationCode":"if len(payload) == 0 { return errors.New(\"empty storepb payload\") }","typeGuard":null,"tryCatchPattern":"if err := resp.Unmarshal(b); err != nil { return fmt.Errorf(\"storepb decode failed: %w\", err) }","preventionTips":["Keep storepb generated code identical across all services (single shared module version)","Never hand-craft storepb bytes; always marshal via the generated types","Checksum payloads transferred over non-gRPC channels","Pin Thanos component versions together (no skew)"],"tags":["protobuf","unmarshal","wire-format","storepb"],"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"}