{"record":{"id":"8a4522f3c1a848c5","repo":"grafana/k6","slug":"parsing-is-checked-options-w","errorCode":null,"errorMessage":"parsing is checked options: %w","messagePattern":"parsing is checked options: %w","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"internal/js/modules/k6/browser/browser/locator_mapping.go","lineNumber":140,"sourceCode":"\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)\n\t\t\t}\n\t\t\treturn promise(vu, func() (any, error) {\n\t\t\t\treturn lo.IsEditable(copts) //nolint:wrapcheck\n\t\t\t}), nil\n\t\t},\n\t\t\"isEnabled\": func(opts sobek.Value) (*sobek.Promise, error) {\n\t\t\tcopts, err := parseFrameIsEnabledOptions(rt, opts, lo.Timeout())\n\t\t\tif err != nil {\n\t\t\t\treturn nil, fmt.Errorf(\"parsing is enabled options: %w\", err)","sourceCodeStart":122,"sourceCodeEnd":158,"githubUrl":"https://github.com/grafana/k6/blob/8d06114777191d21ef885d05c5f8aa9e1ed838ae/internal/js/modules/k6/browser/browser/locator_mapping.go#L122-L158","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","solutions":["Pass a plain object literal, e.g. locator.isChecked({ timeout: 5000, strict: true }) or no argument at all","Make timeout/strict plain data properties, not getters; compute values before the call","If wrapping options (Proxy/logging), export to a plain object first via structuredClone or manual copy","Catch the synchronous exception with try/catch around the call to fail the iteration with a clear message"],"exampleFix":"// before\nconst opts = new Proxy({ timeout: cfg.t }, { get(t, k) { if (k === 'timeout' && t.timeout == null) throw new Error('timeout unset'); return t[k]; } });\nawait locator.isChecked(opts);\n\n// after\nif (cfg.t == null) throw new Error('timeout unset before isChecked');\nawait locator.isChecked({ timeout: cfg.t });","handlingStrategy":"try-catch","validationCode":null,"typeGuard":"function isPlainIsCheckedOptions(o) {\n  return o == null || (typeof o === 'object' &&\n    (o.timeout === undefined || typeof o.timeout === 'number') &&\n    (o.strict === undefined || typeof o.strict === 'boolean'));\n}","tryCatchPattern":"try {\n  const checked = await locator.isChecked(opts);\n} catch (e) {\n  throw new Error(`isChecked failed (validate timeout/strict are plain values): ${e}`);\n}","preventionTips":["Omit options entirely when defaults suffice","Use plain literals: { timeout: 5000, strict: true }","Avoid accessors/Proxies on options objects"],"tags":["k6","browser","locator","ischecked","options","timeout"],"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"}