grafana/k6 · error

parsing is checked options

Error message

parsing is checked options: %w

What it means

Thrown synchronously when the options argument to locator.isChecked() fails to parse. The mapping (locator_mapping.go:136-140) creates common.FrameIsCheckedOptions (a FrameBaseOptions carrying the locator's default timeout) and wraps Parse failures as "parsing is checked options: %w". FrameBaseOptions.Parse (frame_options.go:218-232) reads only "strict" (ToBoolean) and "timeout" (ToInteger) and returns nil unconditionally, so a real failure means property access on the options object itself threw — a getter that raises, a Proxy with a throwing get/ownKeys trap, or a coercion (Symbol.toPrimitive/valueOf) that throws.

Solutions

  1. Pass a plain object literal, e.g. locator.isChecked({ timeout: 5000, strict: true }) or no argument at all
  2. Make timeout/strict plain data properties, not getters; compute values before the call
  3. If wrapping options (Proxy/logging), export to a plain object first via structuredClone or manual copy
  4. Catch the synchronous exception with try/catch around the call to fail the iteration with a clear message

Example fix

// before
const opts = new Proxy({ timeout: cfg.t }, { get(t, k) { if (k === 'timeout' && t.timeout == null) throw new Error('timeout unset'); return t[k]; } });
await locator.isChecked(opts);

// after
if (cfg.t == null) throw new Error('timeout unset before isChecked');
await locator.isChecked({ timeout: cfg.t });
Defensive patterns

Strategy: try-catch

Type guard

function isPlainIsCheckedOptions(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 checked = await locator.isChecked(opts);
} catch (e) {
  throw new Error(`isChecked failed (validate timeout/strict are plain values): ${e}`);
}

Prevention

When it happens

Trigger: Object.defineProperty(opts, 'timeout', { get() { throw new Error('boom') } }) passed to isChecked; a Proxy used as opts whose get or ownKeys trap raises during ToObject/Keys/Get iteration; an object whose toString/valueOf throws when sobek coerces a non-number timeout via ToInteger.

Common situations: Test frameworks that wrap all arguments in tracing Proxies; page objects that compute timeout lazily with a getter that throws on unset config; passing a class instance with accessor properties instead of a plain object literal.

Related errors


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

Appendix: source

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

				return nil, fmt.Errorf("parsing check options: %w", err)
			}
			return promise(vu, func() (any, error) {
				return nil, lo.Check(copts) //nolint:wrapcheck
			}), nil
		},
		"uncheck": func(opts sobek.Value) (*sobek.Promise, error) {
			copts, err := parseFrameUncheckOptions(rt, opts, lo.Timeout())
			if err != nil {
				return nil, fmt.Errorf("parsing uncheck options: %w", err)
			}
			return promise(vu, func() (any, error) {
				return nil, lo.Uncheck(copts) //nolint:wrapcheck
			}), nil
		},
		"isChecked": func(opts sobek.Value) (*sobek.Promise, error) {
			copts, err := parseFrameIsCheckedOptions(rt, opts, lo.Timeout())
			if err != nil {
				return nil, fmt.Errorf("parsing is checked options: %w", err)
			}
			return promise(vu, func() (any, error) {
				return lo.IsChecked(copts) //nolint:wrapcheck
			}), nil
		},
		"isEditable": func(opts sobek.Value) (*sobek.Promise, error) {
			copts, err := parseFrameIsEditableOptions(rt, opts, lo.Timeout())
			if err != nil {
				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)

View on GitHub (pinned to 8d06114777)