{"record":{"id":"66eb3194a825a71c","repo":"grafana/k6","slug":"parsing-uncheck-options-w-66eb31","errorCode":null,"errorMessage":"parsing uncheck options: %w","messagePattern":"parsing uncheck options: %w","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"internal/js/modules/k6/browser/browser/locator_mapping.go","lineNumber":131,"sourceCode":"\t\t\t\treturn nil, fmt.Errorf(\"parsing set checked options: %w\", err)\n\t\t\t}\n\t\t\treturn promise(vu, func() (any, error) {\n\t\t\t\treturn nil, lo.SetChecked(checked, copts) //nolint:wrapcheck\n\t\t\t}), nil\n\t\t},\n\t\t\"check\": func(opts sobek.Value) (*sobek.Promise, error) {\n\t\t\tcopts, err := parseFrameCheckOptions(rt, opts, lo.Timeout())\n\t\t\tif err != nil {\n\t\t\t\treturn nil, fmt.Errorf(\"parsing check options: %w\", err)\n\t\t\t}\n\t\t\treturn promise(vu, func() (any, error) {\n\t\t\t\treturn nil, lo.Check(copts) //nolint:wrapcheck\n\t\t\t}), nil\n\t\t},\n\t\t\"uncheck\": func(opts sobek.Value) (*sobek.Promise, error) {\n\t\t\tcopts, err := parseFrameUncheckOptions(rt, opts, lo.Timeout())\n\t\t\tif err != nil {\n\t\t\t\treturn nil, fmt.Errorf(\"parsing uncheck options: %w\", err)\n\t\t\t}\n\t\t\treturn promise(vu, func() (any, error) {\n\t\t\t\treturn nil, lo.Uncheck(copts) //nolint:wrapcheck\n\t\t\t}), nil\n\t\t},\n\t\t\"isChecked\": func(opts sobek.Value) (*sobek.Promise, error) {\n\t\t\tcopts, err := parseFrameIsCheckedOptions(rt, opts, lo.Timeout())\n\t\t\tif err != nil {\n\t\t\t\treturn nil, fmt.Errorf(\"parsing is checked options: %w\", err)\n\t\t\t}\n\t\t\treturn promise(vu, func() (any, error) {\n\t\t\t\treturn lo.IsChecked(copts) //nolint:wrapcheck\n\t\t\t}), nil\n\t\t},\n\t\t\"isEditable\": func(opts sobek.Value) (*sobek.Promise, error) {\n\t\t\tcopts, err := parseFrameIsEditableOptions(rt, opts, lo.Timeout())\n\t\t\tif err != nil {\n\t\t\t\treturn nil, fmt.Errorf(\"parsing is editable options: %w\", err)","sourceCodeStart":113,"sourceCodeEnd":149,"githubUrl":"https://github.com/grafana/k6/blob/8d06114777191d21ef885d05c5f8aa9e1ed838ae/internal/js/modules/k6/browser/browser/locator_mapping.go#L113-L149","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","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"],"exampleFix":"// before\nconst x = await el.getAttribute('data-x'); // string\nawait locator.uncheck({ position: { x: x, y: '40' } });\n\n// after\nconst x = Number(await el.getAttribute('data-x'));\nawait locator.uncheck({ position: { x: x, y: 40 } });","handlingStrategy":"validation","validationCode":"function assertUncheckOptions(opts) {\n  if (opts == null) return;\n  if (typeof opts !== 'object' || Array.isArray(opts))\n    throw new TypeError('uncheck options must be an object');\n  if (opts.position != null) {\n    const { x, y } = opts.position;\n    if (typeof opts.position !== 'object' || !Number.isFinite(x) || !Number.isFinite(y))\n      throw new TypeError('position must be { x: number, y: number }');\n  }\n}\nassertUncheckOptions(opts);\nawait locator.uncheck(opts);","typeGuard":"function isPointerOptions(o) {\n  return o == null || (typeof o === 'object' &&\n    (o.position === undefined ||\n      (typeof o.position === 'object' && Number.isFinite(o.position.x) && Number.isFinite(o.position.y))));\n}","tryCatchPattern":"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; }","preventionTips":["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"],"tags":["k6","browser","locator","uncheck","options","position"],"backgroundTag":"invalid-options-object","analyzedSha":"8d06114777191d21ef885d05c5f8aa9e1ed838ae","analyzedAt":"2026-09-14T20:10:14.619Z","contentChangedAt":"2026-09-14T20:10:14.619Z","schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}