{"record":{"id":"7d6221f9537aa9e7","repo":"grafana/k6","slug":"parsing-is-enabled-options-w","errorCode":null,"errorMessage":"parsing is enabled options: %w","messagePattern":"parsing is enabled options: %w","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"internal/js/modules/k6/browser/browser/locator_mapping.go","lineNumber":158,"sourceCode":"\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)\n\t\t\t}\n\t\t\treturn promise(vu, func() (any, error) {\n\t\t\t\treturn lo.IsEnabled(copts) //nolint:wrapcheck\n\t\t\t}), nil\n\t\t},\n\t\t\"isDisabled\": func(opts sobek.Value) (*sobek.Promise, error) {\n\t\t\tcopts, err := parseFrameIsDisabledOptions(rt, opts, lo.Timeout())\n\t\t\tif err != nil {\n\t\t\t\treturn nil, fmt.Errorf(\"parsing is disabled options: %w\", err)\n\t\t\t}\n\t\t\treturn promise(vu, func() (any, error) {\n\t\t\t\treturn lo.IsDisabled(copts) //nolint:wrapcheck\n\t\t\t}), nil\n\t\t},\n\t\t\"isInViewport\": func(opts sobek.Value) (*sobek.Promise, error) {\n\t\t\tcopts, err := parseFrameIsInViewportOptions(rt, opts, lo.Timeout())\n\t\t\tif err != nil {\n\t\t\t\treturn nil, fmt.Errorf(\"parsing is in viewport options: %w\", err)","sourceCodeStart":140,"sourceCodeEnd":176,"githubUrl":"https://github.com/grafana/k6/blob/8d06114777191d21ef885d05c5f8aa9e1ed838ae/internal/js/modules/k6/browser/browser/locator_mapping.go#L140-L176","documentation":"Thrown synchronously when the options argument to locator.isEnabled() fails to parse. The mapping (locator_mapping.go:155-159) creates common.FrameIsEnabledOptions (FrameBaseOptions seeded with the locator timeout) and wraps failures as \"parsing is enabled options: %w\". Because FrameBaseOptions.Parse reads only strict/timeout via coercing accessors and cannot fail on values, the wrapped error originates in sobek property access on the options object — throwing getters, Proxy traps, or throwing implicit conversions.","triggerScenarios":"Options object with a getter for timeout/strict that throws; Proxy-wrapped options with raising get/ownKeys traps; a timeout whose Symbol.toPrimitive raises during ToInteger.","commonSituations":"Debug/tracing wrappers that proxy every argument; page objects with computed accessors; passing frozen/exotic objects that intercept enumeration.","solutions":["Pass a plain literal or omit options: locator.isEnabled({ timeout: 2000 })","Precompute any dynamic option values into plain properties","Avoid Proxy or accessor properties on objects handed to the browser module","Use try/catch to convert the synchronous throw into a test failure with context"],"exampleFix":"// before\nawait locator.isEnabled(proxiedOpts); // Proxy get trap throws\n\n// after\nawait locator.isEnabled({ timeout: proxiedOpts.timeout }); // reads trap safely before call","handlingStrategy":"try-catch","validationCode":null,"typeGuard":"function isPlainBaseOptions(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 enabled = await locator.isEnabled(opts);\n} catch (e) {\n  throw new Error(`isEnabled failed (inspect options object for throwing getters): ${e}`);\n}","preventionTips":["Materialize lazy config before building options","Use literals for one-off calls","Keep instrumentation Proxies out of browser API arguments"],"tags":["k6","browser","locator","isenabled","options"],"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"}