{"record":{"id":"fec37c53c1359213","repo":"gravitational/teleport","slug":"proto-wrong-wiretype-d-for-field-passwordless","errorCode":null,"errorMessage":"proto: wrong wireType = %d for field Passwordless","messagePattern":"proto: wrong wireType = (.+?) for field Passwordless","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"api/client/proto/authservice.pb.go","lineNumber":60140,"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 := &ContextUser{}\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_ContextUser{v}\n\t\t\tiNdEx = postIndex\n\t\tcase 4:\n\t\t\tif wireType != 2 {\n\t\t\t\treturn fmt.Errorf(\"proto: wrong wireType = %d for field Passwordless\", 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":60122,"sourceCodeEnd":60158,"githubUrl":"https://github.com/gravitational/teleport/blob/1283425b60ec5f60d509ba4c791183d452923ff7/api/client/proto/authservice.pb.go#L60122-L60158","documentation":"Protobuf unmarshal guard in generated code: while decoding CreateAuthenticateChallengeRequest, the Passwordless oneof field arrived with an unexpected wire type instead of the length-delimited type expected for a message.","triggerScenarios":"Decoding bytes where tag 4 carries a non-length-delimited value — incompatible serialization, hand-assembled frames, or version skew between peers.","commonSituations":"Older client sending a pre-oneof shape of the request; test fixture bytes built manually; intermediary rewriting fields.","solutions":["Populate Request via &CreateAuthenticateChallengeRequest_Passwordless{...} and Marshal normally","Ensure both peers compile the same authservice.proto","Check for byte-stream offset/corruption issues in the transport","Regenerate .pb.go files from current protos"],"exampleFix":"// before\n// bytes written with wrong encoding for field 4\n// after\nm.Request = &proto.CreateAuthenticateChallengeRequest_Passwordless{\n  Passwordless: &proto.Passwordless{User: \"alice\"},\n}\nb, _ := m.Marshal()","handlingStrategy":"type-guard","validationCode":"if req.GetPasswordless() == nil && req.GetRequest() == nil { return errors.New(\"no request variant set\") }","typeGuard":"func isPasswordless(r *proto.CreateAuthenticateChallengeRequest) (*proto.Passwordless, bool) {\n  v, ok := r.GetRequest().(*proto.CreateAuthenticateChallengeRequest_Passwordless)\n  if !ok { return nil, false }\n  return v.Passwordless, true\n}","tryCatchPattern":null,"preventionTips":["Assign Passwordless only via CreateAuthenticateChallengeRequest_Passwordless","Never serialize fields manually with wrong wire types","Keep client/server generated code in sync","Hex-dump failing payloads to spot encoding mistakes early"],"tags":["protobuf","grpc","oneof","wire-format"],"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"}