grafana/k6 · error
parsing uncheck options
Error message
parsing uncheck options: %w
What it means
Thrown synchronously by the k6 browser module when the options object passed to locator.uncheck() cannot be parsed by the Go side. The mapping (locator_mapping.go:127-131) builds a common.FrameUncheckOptions seeded with the locator timeout, calls Parse, and wraps any failure as "parsing uncheck options: %w". Parse delegates to ElementHandleBasePointerOptions.Parse, which only fails when exporting the "position" key to map[string]float64 fails (element_handle_options.go:188-195); all other keys (force, noWaitAfter, timeout, trial, strict) use coercing accessors that effectively never error.
Solutions
- Pass position as a plain object with numeric x and y measured from the element's top-left corner: { position: { x: 10, y: 20 } }
- Convert any string coordinates with Number() before passing them (e.g. from getAttribute or dataset values)
- Only include recognized keys: position, trial, force, noWaitAfter, timeout (ms, number), strict (boolean); unknown keys are ignored but their getters still run, so keep the object a plain literal
- Remove Proxy wrappers or getters that throw from the options object
Example fix
// before
const x = await el.getAttribute('data-x'); // string
await locator.uncheck({ position: { x: x, y: '40' } });
// after
const x = Number(await el.getAttribute('data-x'));
await locator.uncheck({ position: { x: x, y: 40 } }); Defensive patterns
Strategy: validation
Validate before calling
function assertUncheckOptions(opts) {
if (opts == null) return;
if (typeof opts !== 'object' || Array.isArray(opts))
throw new TypeError('uncheck options must be an object');
if (opts.position != null) {
const { x, y } = opts.position;
if (typeof opts.position !== 'object' || !Number.isFinite(x) || !Number.isFinite(y))
throw new TypeError('position must be { x: number, y: number }');
}
}
assertUncheckOptions(opts);
await locator.uncheck(opts); Type guard
function isPointerOptions(o) {
return o == null || (typeof o === 'object' &&
(o.position === undefined ||
(typeof o.position === 'object' && Number.isFinite(o.position.x) && Number.isFinite(o.position.y))));
} Try / catch
try { await locator.uncheck(opts); } catch (e) { if (String(e).includes('parsing uncheck options')) throw new Error(`bad uncheck options: ${JSON.stringify(opts)}`); throw e; } Prevention
- Always build position as { x: Number(x), y: Number(y) }
- Keep options as plain object literals
- Never pass Proxy-wrapped or getter-decorated objects to browser APIs
When it happens
Trigger: Calling locator.uncheck({ position: 'center' }) or position: 10 (not an {x,y} object); position: { x: '10', y: 20 } with string coordinates that encoding-style export cannot convert to float64; also a Proxy or throwing getter on the options object, which makes ToObject/Get raise inside Parse.
Common situations: Porting Playwright scripts and hand-building a position object with coordinates read from the DOM as strings; passing a computed position variable that is undefined/null/not an object; wrapping options in a Proxy for logging; k6 version 0.4x+ where the browser module graduated and strict option parsing via sobek ExportTo was introduced.
Related errors
- parsing hover options
- parsing locator tap options
- parsing check options
- parsing double click options
- parsing double click options
AI-assisted analysis of grafana/k6@8d06114777 (2026-09-14).
Data as JSON: /api/errors/66eb3194a825a71c.
Report an issue: GitHub.
Appendix: source
Thrown at internal/js/modules/k6/browser/browser/locator_mapping.go:131
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)
}
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)View on GitHub (pinned to 8d06114777)