{"record":{"id":"b3384ffa11d9378c","repo":"grafana/k6","slug":"parsing-clear-options-w","errorCode":null,"errorMessage":"parsing clear options: %w","messagePattern":"parsing clear options: %w","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"internal/js/modules/k6/browser/browser/locator_mapping.go","lineNumber":52,"sourceCode":"\t\t\"boundingBox\": func(opts sobek.Value) (*sobek.Promise, error) {\n\t\t\tpopts := common.NewFrameBaseOptions(lo.Timeout())\n\t\t\tif err := parseFrameBaseOptions(popts, rt, opts); err != nil {\n\t\t\t\treturn nil, fmt.Errorf(\"parsing locator bounding box options: %w\", err)\n\t\t\t}\n\t\t\treturn promise(vu, func() (any, error) {\n\t\t\t\tbox, err := lo.BoundingBox(popts)\n\t\t\t\t// We want to avoid errors when an element is not visible or detached and instead\n\t\t\t\t// opt to return a nil rectangle -- this matches Playwright's behaviour.\n\t\t\t\tif errors.Is(err, common.ErrElementNotVisible) || errors.Is(err, common.ErrElementNotAttachedToDOM) {\n\t\t\t\t\treturn nil, nil\n\t\t\t\t}\n\t\t\t\treturn box, err\n\t\t\t}), nil\n\t\t},\n\t\t\"clear\": func(opts sobek.Value) (*sobek.Promise, error) {\n\t\t\tcopts, err := parseFrameFillOptions(rt, opts, lo.Timeout())\n\t\t\tif err != nil {\n\t\t\t\treturn nil, fmt.Errorf(\"parsing clear options: %w\", err)\n\t\t\t}\n\t\t\treturn promise(vu, func() (any, error) {\n\t\t\t\treturn nil, lo.Clear(copts) //nolint:wrapcheck\n\t\t\t}), nil\n\t\t},\n\t\t\"click\": func(opts sobek.Value) (*sobek.Promise, error) {\n\t\t\tpopts, err := parseFrameClickOptions(rt, opts, lo.Timeout())\n\t\t\tif err != nil {\n\t\t\t\treturn nil, err\n\t\t\t}\n\n\t\t\treturn promise(vu, func() (any, error) {\n\t\t\t\treturn nil, lo.Click(popts) //nolint:wrapcheck\n\t\t\t}), nil\n\t\t},\n\t\t\"contentFrame\": func() *sobek.Object {\n\t\t\tml := mapFrameLocator(vu, lo.ContentFrame())\n\t\t\treturn rt.ToValue(ml).ToObject(rt)","sourceCodeStart":34,"sourceCodeEnd":70,"githubUrl":"https://github.com/grafana/k6/blob/8d06114777191d21ef885d05c5f8aa9e1ed838ae/internal/js/modules/k6/browser/browser/locator_mapping.go#L34-L70","documentation":"Thrown while parsing the options object of locator.clear(options) (browser/locator_mapping.go:51). It wraps FrameFillOptions.Parse, which (via ElementHandleBaseOptions.Parse and parseStrict) reads force, noWaitAfter, strict and timeout coercively and has no failing branch in current k6 — the wrap is defensive. clear() reuses the fill-options shape because it fills an empty string.","triggerScenarios":"Exotic options values (Symbol, throwing getters) that break sobek traversal; older k6 versions with strict exportTo parsing of these fields.","commonSituations":"Passing fill-specific options like position or modifiers to clear() (they are ignored rather than rejected, which confuses debugging); options from JSON with string timeouts on older builds.","solutions":["Pass a plain object { timeout: <number>, force: <bool>, noWaitAfter: <bool>, strict: <bool> } or omit it","Coerce dynamic values (Number/Boolean) before the call","Do not expect clear() to accept pointer options like position","Upgrade k6 if an ordinary object triggers this error"],"exampleFix":"// before\nlocator.clear({ timeout: __ENV.T });\n// after\nlocator.clear({ timeout: Number(__ENV.T) });","handlingStrategy":"validation","validationCode":"const o = (opts == null) ? undefined : {\n  ...(opts.timeout !== undefined && { timeout: Number(opts.timeout) }),\n  ...(opts.force !== undefined && { force: Boolean(opts.force) }),\n  ...(opts.noWaitAfter !== undefined && { noWaitAfter: Boolean(opts.noWaitAfter) }),\n  ...(opts.strict !== undefined && { strict: Boolean(opts.strict) }),\n};","typeGuard":"function isClearOptions(o) {\n  if (o == null) return true;\n  if (typeof o !== 'object' || Array.isArray(o)) return false;\n  return (o.timeout === undefined || typeof o.timeout === 'number');\n}","tryCatchPattern":"try { await locator.clear(o); } catch (e) { if (!String(e.message).includes('parsing clear options')) throw e; }","preventionTips":["clear() accepts fill-style options only; pointer options like position are not honored","Use force: true for covered inputs instead of inventing unsupported keys","Normalize options from config before passing"],"tags":["k6","k6-browser","locator","clear","options"],"backgroundTag":"options-validation-failed","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"}