grafana/k6 · error
parsing is enabled options
Error message
parsing is enabled options: %w
What it means
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.
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
Example fix
// before
await locator.isEnabled(proxiedOpts); // Proxy get trap throws
// after
await locator.isEnabled({ timeout: proxiedOpts.timeout }); // reads trap safely before call Defensive patterns
Strategy: try-catch
Type guard
function isPlainBaseOptions(o) {
return o == null || (typeof o === 'object' &&
(o.timeout === undefined || typeof o.timeout === 'number') &&
(o.strict === undefined || typeof o.strict === 'boolean'));
} Try / catch
try {
const enabled = await locator.isEnabled(opts);
} catch (e) {
throw new Error(`isEnabled failed (inspect options object for throwing getters): ${e}`);
} Prevention
- Materialize lazy config before building options
- Use literals for one-off calls
- Keep instrumentation Proxies out of browser API arguments
When it happens
Trigger: 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.
Common situations: Debug/tracing wrappers that proxy every argument; page objects with computed accessors; passing frozen/exotic objects that intercept enumeration.
Related errors
- parsing fill options
- parsing focus options
- parsing get attribute options
- parsing hover options
- parsing inner HTML options
AI-assisted analysis of grafana/k6@8d06114777 (2026-09-14).
Data as JSON: /api/errors/7d6221f9537aa9e7.
Report an issue: GitHub.
Appendix: source
Thrown at internal/js/modules/k6/browser/browser/locator_mapping.go:158
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)
}
return promise(vu, func() (any, error) {
return lo.IsEditable(copts) //nolint:wrapcheck
}), nil
},
"isEnabled": func(opts sobek.Value) (*sobek.Promise, error) {
copts, err := parseFrameIsEnabledOptions(rt, opts, lo.Timeout())
if err != nil {
return nil, fmt.Errorf("parsing is enabled options: %w", err)
}
return promise(vu, func() (any, error) {
return lo.IsEnabled(copts) //nolint:wrapcheck
}), nil
},
"isDisabled": func(opts sobek.Value) (*sobek.Promise, error) {
copts, err := parseFrameIsDisabledOptions(rt, opts, lo.Timeout())
if err != nil {
return nil, fmt.Errorf("parsing is disabled options: %w", err)
}
return promise(vu, func() (any, error) {
return lo.IsDisabled(copts) //nolint:wrapcheck
}), nil
},
"isInViewport": func(opts sobek.Value) (*sobek.Promise, error) {
copts, err := parseFrameIsInViewportOptions(rt, opts, lo.Timeout())
if err != nil {
return nil, fmt.Errorf("parsing is in viewport options: %w", err)View on GitHub (pinned to 8d06114777)