grafana/k6 · error

wrong polling option value

Error message

wrong polling option value: %q; possible values: "raf", "mutation" or number

What it means

Returned while parsing waitForFunction options: the polling value is neither a number (interval) nor one of the recognized strings ('raf', 'mutation'), falling through to the default branch of the type switch. The offending value is included. Pure user-input validation.

Solutions

  1. Set polling to 'raf', 'mutation', or a number of milliseconds
  2. Do not pass booleans, objects, or other strings as polling
Defensive patterns

Strategy: validation

When it happens

Trigger: Thrown at internal/js/modules/k6/browser/common/frame_options.go:671 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/89df33d17b4b1274. Report an issue: GitHub.

Appendix: source

Thrown at internal/js/modules/k6/browser/common/frame_options.go:671

	obj := opts.ToObject(rt)
	for _, k := range obj.Keys() {
		v := obj.Get(k)
		switch k {
		case "timeout":
			o.Timeout = time.Duration(v.ToInteger()) * time.Millisecond
		case "polling":
			switch v.ExportType().Kind() {
			case reflect.Int64:
				o.Polling = PollingInterval
				o.Interval = v.ToInteger()
			case reflect.String:
				if p, ok := pollingTypeToID[v.ToString().String()]; ok {
					o.Polling = p
					break
				}
				fallthrough
			default:
				return fmt.Errorf("wrong polling option value: %q; "+
					`possible values: "raf", "mutation" or number`, v)
			}
		}
	}

	return nil
}

func NewFrameWaitForLoadStateOptions(defaultTimeout time.Duration) *FrameWaitForLoadStateOptions {
	return &FrameWaitForLoadStateOptions{
		Timeout: defaultTimeout,
	}
}

// Parse parses the frame waitForLoadState options.
func (o *FrameWaitForLoadStateOptions) Parse(ctx context.Context, opts sobek.Value) error {
	rt := k6ext.Runtime(ctx)
	if !common.IsNullish(opts) {

View on GitHub (pinned to 01ffac6f24)