grafana/k6 · error

parsing is disabled options

Error message

parsing is disabled options: %w

What it means

Thrown synchronously when the options argument to locator.isDisabled() fails to parse. The mapping (locator_mapping.go:164-168) builds common.FrameIsDisabledOptions (FrameBaseOptions) and re-wraps Parse errors as "parsing is disabled options: %w". FrameBaseOptions.Parse only touches strict (boolean coercion) and timeout (integer coercion), so an actual error means sobek raised while reading the object — a throwing getter on those keys, a Proxy trap, or a toPrimitive/valueOf that throws.

Solutions

  1. Use a plain object literal: locator.isDisabled({ timeout: 5000 }) or no argument
  2. Materialize computed options into plain values before the call
  3. Strip Proxies/accessors from anything passed to browser APIs
  4. try/catch the call to surface a clean failure message

Example fix

// before
const opts = { get timeout() { return computeTimeout(); } }; // computeTimeout throws when config missing
await locator.isDisabled(opts);

// after
const timeout = computeTimeout();
await locator.isDisabled({ timeout });
Defensive patterns

Strategy: try-catch

Type guard

function isPlainBaseOptions(o) {
  return o == null || (typeof o === 'object' &&
    (o.timeout === undefined || typeof o.timeout === 'number') &&
    (o.strict === undefined || typeof o.strict === 'boolean'));
}

Try / catch

try {
  const disabled = await locator.isDisabled(opts);
} catch (e) {
  throw new Error(`isDisabled failed (options must be plain data): ${e}`);
}

Prevention

When it happens

Trigger: A getter for timeout or strict that raises; Proxy options whose get/ownKeys traps throw; a non-number timeout whose coercion method throws (e.g. an object with valueOf() { throw ... }).

Common situations: Argument-inspecting harnesses built on Proxy; config objects with validation getters; ported Playwright helpers that decorate option objects with accessors.

Related errors


AI-assisted analysis of grafana/k6@8d06114777 (2026-09-14). Data as JSON: /api/errors/c5cb2bc0d9a41f83. Report an issue: GitHub.

Appendix: source

Thrown at internal/js/modules/k6/browser/browser/locator_mapping.go:167

				return nil, fmt.Errorf("parsing is editable options: %w", err)
			}
			return promise(vu, func() (any, error) {
				return lo.IsEditable(copts) //nolint:wrapcheck
			}), nil
		},
		"isEnabled": func(opts sobek.Value) (*sobek.Promise, error) {
			copts, err := parseFrameIsEnabledOptions(rt, opts, lo.Timeout())
			if err != nil {
				return nil, fmt.Errorf("parsing is enabled options: %w", err)
			}
			return promise(vu, func() (any, error) {
				return lo.IsEnabled(copts) //nolint:wrapcheck
			}), nil
		},
		"isDisabled": func(opts sobek.Value) (*sobek.Promise, error) {
			copts, err := parseFrameIsDisabledOptions(rt, opts, lo.Timeout())
			if err != nil {
				return nil, fmt.Errorf("parsing is disabled options: %w", err)
			}
			return promise(vu, func() (any, error) {
				return lo.IsDisabled(copts) //nolint:wrapcheck
			}), nil
		},
		"isInViewport": func(opts sobek.Value) (*sobek.Promise, error) {
			copts, err := parseFrameIsInViewportOptions(rt, opts, lo.Timeout())
			if err != nil {
				return nil, fmt.Errorf("parsing is in viewport options: %w", err)
			}
			return promise(vu, func() (any, error) {
				return lo.IsInViewport(copts) //nolint:wrapcheck
			}), nil
		},
		"isVisible": func() *sobek.Promise {
			return promise(vu, func() (any, error) {
				return lo.IsVisible() //nolint:wrapcheck
			})

View on GitHub (pinned to 8d06114777)