grafana/k6 · error

invalid lifecycle event: %q; must be one of: %s

Error message

invalid lifecycle event: %q; must be one of: %s

What it means

Error "invalid lifecycle event: %q; must be one of: %s" thrown in grafana/k6.

Source

Thrown at internal/js/modules/k6/browser/common/lifecycle.go:103

}

// UnmarshalText unmarshals a text representation to the enum value.
// It returns an error if given a wrong value.
func (l *LifecycleEvent) UnmarshalText(text []byte) error {
	var (
		ok  bool
		val = string(text)
	)

	if *l, ok = lifecycleEventToID[val]; !ok {
		valid := make([]string, 0, len(lifecycleEventToID))
		for k := range lifecycleEventToID {
			valid = append(valid, k)
		}
		sort.Slice(valid, func(i, j int) bool {
			return lifecycleEventToID[valid[j]] > lifecycleEventToID[valid[i]]
		})
		return fmt.Errorf(
			"invalid lifecycle event: %q; must be one of: %s",
			val, strings.Join(valid, ", "))
	}

	return nil
}

View on GitHub (pinned to 93accf6570)

When it happens

Trigger: Thrown at internal/js/modules/k6/browser/common/lifecycle.go:103 when the library encounters an invalid state.

Common situations: See trigger scenarios.


AI-assisted analysis of grafana/k6@93accf6570 (2026-08-15). Data as JSON: /api/errors/cf22677ccca9c413. Report an issue: GitHub.