grafana/k6 · error

parsing is editable options

Error message

parsing is editable options: %w

What it means

Thrown synchronously when the options argument to locator.isEditable() fails to parse. The mapping (locator_mapping.go:146-150) builds common.FrameIsEditableOptions (FrameBaseOptions with the locator timeout) and wraps any Parse failure as "parsing is editable options: %w". FrameBaseOptions.Parse only reads strict and timeout with coercing accessors and returns nil, so in practice the wrapped error comes from sobek raising while enumerating or reading the options object (throwing getter, Proxy trap, or throwing coercion).

Solutions

  1. Call locator.isEditable() with no options or a plain literal: { timeout: 3000 }
  2. Resolve dynamic values before the call so options are plain data
  3. Unwrap Proxies before passing options to browser APIs
  4. Wrap the call in try/catch and fail fast with a descriptive error

Example fix

// before
class Opts { get timeout() { return this.cfg?.timeout; } }
await locator.isEditable(new Opts());

// after
const timeout = cfg?.timeout ?? 3000;
await locator.isEditable({ timeout });
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 editable = await locator.isEditable(opts);
} catch (e) {
  throw new Error(`isEditable failed (check timeout/strict getters): ${e}`);
}

Prevention

When it happens

Trigger: opts with a throwing getter for timeout or strict (Object.defineProperty or class accessor); a Proxy around the options object whose ownKeys/get trap raises; a timeout value whose toPrimitive/valueOf throws during ToInteger coercion.

Common situations: Lazy page-object config getters that throw on missing values; argument-intercepting Proxies from debug/tracing harnesses; passing non-plain objects (class instances with accessors) where a literal is expected.

Related errors


AI-assisted analysis of grafana/k6@8d06114777 (2026-09-14). Data as JSON: /api/errors/800861fe59159d61. Report an issue: GitHub.

Appendix: source

Thrown at internal/js/modules/k6/browser/browser/locator_mapping.go:149

				return nil, fmt.Errorf("parsing uncheck options: %w", err)
			}
			return promise(vu, func() (any, error) {
				return nil, lo.Uncheck(copts) //nolint:wrapcheck
			}), nil
		},
		"isChecked": func(opts sobek.Value) (*sobek.Promise, error) {
			copts, err := parseFrameIsCheckedOptions(rt, opts, lo.Timeout())
			if err != nil {
				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)

View on GitHub (pinned to 8d06114777)