{"record":{"id":"98969e0ac406feb6","repo":"gravitational/teleport","slug":"proto-wrong-wiretype-d-for-field-mfarequiredch","errorCode":null,"errorMessage":"proto: wrong wireType = %d for field MFARequiredCheck","messagePattern":"proto: wrong wireType = (.+?) for field MFARequiredCheck","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"api/client/proto/authservice.pb.go","lineNumber":60175,"sourceCode":"\t\t\tif msglen < 0 {\n\t\t\t\treturn ErrInvalidLengthAuthservice\n\t\t\t}\n\t\t\tpostIndex := iNdEx + msglen\n\t\t\tif postIndex < 0 {\n\t\t\t\treturn ErrInvalidLengthAuthservice\n\t\t\t}\n\t\t\tif postIndex > l {\n\t\t\t\treturn io.ErrUnexpectedEOF\n\t\t\t}\n\t\t\tv := &Passwordless{}\n\t\t\tif err := v.Unmarshal(dAtA[iNdEx:postIndex]); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t\tm.Request = &CreateAuthenticateChallengeRequest_Passwordless{v}\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 MFARequiredCheck\", 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 ErrIntOverflowAuthservice\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 ErrInvalidLengthAuthservice","sourceCodeStart":60157,"sourceCodeEnd":60193,"githubUrl":"https://github.com/gravitational/teleport/blob/1283425b60ec5f60d509ba4c791183d452923ff7/api/client/proto/authservice.pb.go#L60157-L60193","documentation":"Protobuf unmarshal guard in generated code: while decoding CreateAuthenticateChallengeRequest, the MFARequiredCheck oneof field arrived with an unexpected wire type instead of the length-delimited type expected for a message.","triggerScenarios":"Bytes where tag 5 is encoded with a wire type other than 2 — e.g. a proto version where MFARequiredCheck was a scalar, or corrupted/hand-built payloads.","commonSituations":"Client/server version skew after MFARequiredCheck changed kind; manual wire construction in tests; corruption in custom transports.","solutions":["Rebuild both sides from the same proto so field 5 is the same type","Set MFARequiredCheck through the generated struct and Marshal","Inspect the offending bytes with protoc --decode_raw","Regenerate stale generated code"],"exampleFix":"// before\n// MFARequiredCheck serialized as bool\n// after\nm.MFARequiredCheck = &proto.MFARequiredCheck{Required: true}\nb, _ := m.Marshal()","handlingStrategy":"validation","validationCode":"// MFARequiredCheck is a message field; verify it is set as a struct, not a scalar\nif req.MFARequiredCheck == nil { req.MFARequiredCheck = &proto.MFARequiredCheck{} }","typeGuard":"func hasMFARequiredCheck(r *proto.CreateAuthenticateChallengeRequest) bool {\n  return r.GetMFARequiredCheck() != nil\n}","tryCatchPattern":null,"preventionTips":["Treat MFARequiredCheck as a message; never encode it as a scalar","Update all peers when a field changes kind (scalar <-> message)","Add golden round-trip tests for every request type","Regenerate generated code as part of proto changes"],"tags":["protobuf","grpc","wire-format","version-skew"],"backgroundTag":"protobuf-wire-type-mismatch","analyzedSha":"1283425b60ec5f60d509ba4c791183d452923ff7","analyzedAt":"2026-09-02T04:06:41.601Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-08T10:18:20.063Z"}