grafana/k6 · error
parsing check options
Error message
parsing check options: %w
What it means
Thrown while parsing the options object of locator.check(options) (browser/locator_mapping.go:121). Like setChecked it wraps FrameCheckOptions.Parse, and the only failing branch is position (must export to a numeric x/y map via ElementHandleBasePointerOptions.Parse). strict, force, noWaitAfter, trial and timeout are coerced.
Solutions
- Use position: { x: 5, y: 5 } with numeric fields
- Drop position to click the element center
- Normalize config values with Number()
- Keep check/uncheck option builders in one place so the shape stays correct
Example fix
// before
locator.check({ position: [5, 5] });
// after
locator.check({ position: { x: 5, y: 5 } }); Defensive patterns
Strategy: validation
Validate before calling
if (opts?.position != null &&
!(typeof opts.position === 'object' && typeof opts.position.x === 'number' && typeof opts.position.y === 'number')) {
throw new Error('position must be { x: number, y: number }');
} Type guard
function isCheckOptions(o) {
if (o == null) return true;
if (typeof o !== 'object' || Array.isArray(o)) return false;
const p = o.position;
return p == null || (typeof p === 'object' && typeof p.x === 'number' && typeof p.y === 'number');
} Try / catch
try { await locator.check(opts); } catch (e) { if (!String(e.message).includes('parsing check options')) throw e; } Prevention
- Use { x, y } numeric positions only
- Build check/uncheck options from one validated helper
- Convert any coordinates from external data with Number() before use
When it happens
Trigger: locator.check({ position: [5, 5] }); locator.check({ position: 'center' }); string x/y values from config objects.
Common situations: Terms-of-service/consent checkbox flows; ported Playwright scripts with array positions; shared option objects reused across check() and click() where shapes drifted.
Related errors
- parsing double click options
- parsing set checked options
- parsing clear options
- parsing frame uncheck options
- parsing hover options
AI-assisted analysis of grafana/k6@8d06114777 (2026-09-14).
Data as JSON: /api/errors/fbd656626cac4164.
Report an issue: GitHub.
Appendix: source
Thrown at internal/js/modules/k6/browser/browser/locator_mapping.go:122
if err != nil {
return nil, err //nolint:wrapcheck
}
return mapJSHandle(vu, jsh), nil
}), nil
},
"setChecked": func(checked bool, opts sobek.Value) (*sobek.Promise, error) {
copts, err := parseFrameCheckOptions(rt, opts, lo.Timeout())
if err != nil {
return nil, fmt.Errorf("parsing set checked options: %w", err)
}
return promise(vu, func() (any, error) {
return nil, lo.SetChecked(checked, copts) //nolint:wrapcheck
}), nil
},
"check": func(opts sobek.Value) (*sobek.Promise, error) {
copts, err := parseFrameCheckOptions(rt, opts, lo.Timeout())
if err != nil {
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)View on GitHub (pinned to 8d06114777)