{"record":{"id":"cf22677ccca9c413","repo":"grafana/k6","slug":"invalid-lifecycle-event-q-must-be-one-of-s","errorCode":null,"errorMessage":"invalid lifecycle event: %q; must be one of: %s","messagePattern":"invalid lifecycle event: %q; must be one of: (.+?)","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"internal/js/modules/k6/browser/common/lifecycle.go","lineNumber":103,"sourceCode":"}\n\n// UnmarshalText unmarshals a text representation to the enum value.\n// It returns an error if given a wrong value.\nfunc (l *LifecycleEvent) UnmarshalText(text []byte) error {\n\tvar (\n\t\tok  bool\n\t\tval = string(text)\n\t)\n\n\tif *l, ok = lifecycleEventToID[val]; !ok {\n\t\tvalid := make([]string, 0, len(lifecycleEventToID))\n\t\tfor k := range lifecycleEventToID {\n\t\t\tvalid = append(valid, k)\n\t\t}\n\t\tsort.Slice(valid, func(i, j int) bool {\n\t\t\treturn lifecycleEventToID[valid[j]] > lifecycleEventToID[valid[i]]\n\t\t})\n\t\treturn fmt.Errorf(\n\t\t\t\"invalid lifecycle event: %q; must be one of: %s\",\n\t\t\tval, strings.Join(valid, \", \"))\n\t}\n\n\treturn nil\n}\n","sourceCodeStart":85,"sourceCodeEnd":110,"githubUrl":"https://github.com/grafana/k6/blob/01ffac6f245854c1b8adc6a69857c76a15f90022/internal/js/modules/k6/browser/common/lifecycle.go#L85-L110","documentation":"Returned by LifecycleEvent.UnmarshalText when the text value is not a recognized lifecycle event name; it is a validation guard that lists all accepted values (load, domcontentloaded, networkidle). The input at fault is the unrecognized event string.","triggerScenarios":"Thrown at internal/js/modules/k6/browser/common/lifecycle.go:103 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Use one of the valid lifecycle events: load, domcontentloaded, or networkidle","Check for typos and case sensitivity in the event name in the script","Parse the error message, which enumerates all valid values, to pick a supported one"],"exampleFix":null,"handlingStrategy":"validation","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"01ffac6f245854c1b8adc6a69857c76a15f90022","analyzedAt":"2026-08-18T03:05:52.393Z","contentChangedAt":"2026-08-18T03:05:52.393Z","schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}