grafana/k6 · error

unknown option

Error message

unknown option: %s

What it means

Strict-key validation in parseWaitForEventOptions: the options object passed to waitForEvent contained a key other than 'predicate' or 'timeout'. Unlike many k6 APIs, unknown keys are rejected outright here rather than ignored — commonly a typo like 'timout' or an unsupported option.

Solutions

  1. Remove the unknown key; only 'predicate' and 'timeout' are supported
  2. Check for typos in option names (e.g. 'timout' instead of 'timeout')
  3. Note that timeout is specified in milliseconds, not an options string
Defensive patterns

Strategy: validation

When it happens

Trigger: Thrown at internal/js/modules/k6/browser/browser/browser_context_mapping.go:220 when the library encounters an invalid state.

Common situations: See trigger scenarios.


AI-assisted analysis of grafana/k6@01ffac6f24 (2026-08-18). Data as JSON: /api/errors/2612d47be53a8477. Report an issue: GitHub.

Appendix: source

Thrown at internal/js/modules/k6/browser/browser/browser_context_mapping.go:220

	}
	var isCallable bool
	w.PredicateFn, isCallable = sobek.AssertFunction(optsOrPredicate)
	if isCallable {
		return w, nil
	}

	opts := optsOrPredicate.ToObject(rt)
	for _, k := range opts.Keys() {
		switch k {
		case "predicate":
			w.PredicateFn, isCallable = sobek.AssertFunction(opts.Get(k))
			if !isCallable {
				return nil, errors.New("predicate function is not callable")
			}
		case "timeout":
			w.Timeout = time.Duration(opts.Get(k).ToInteger()) * time.Millisecond
		default:
			return nil, fmt.Errorf("unknown option: %s", k)
		}
	}

	return w, nil
}

View on GitHub (pinned to 01ffac6f24)