{"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/93accf6570dcd306ca5e99cc44c393ee3797761b/internal/js/modules/k6/browser/common/lifecycle.go#L85-L110","documentation":"Error \"invalid lifecycle event: %q; must be one of: %s\" thrown in grafana/k6.","triggerScenarios":"Thrown at internal/js/modules/k6/browser/common/lifecycle.go:103 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":[],"exampleFix":null,"handlingStrategy":null,"validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"93accf6570dcd306ca5e99cc44c393ee3797761b","analyzedAt":"2026-08-15T21:23:27.118Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}