grafana/k6 · error

parsing input value options

Error message

parsing input value options: %w

What it means

Thrown synchronously when the options argument to locator.inputValue() fails to parse. The mapping (locator_mapping.go:346-350) builds common.FrameInputValueOptions (FrameBaseOptions with the locator timeout) and wraps Parse failures as "parsing input value options: %w". Parse reads only strict and timeout through coercing accessors that tolerate ordinary type errors, so the wrapped error means sobek raised while reading the options object — throwing getter, Proxy trap, or throwing toPrimitive/valueOf.

Solutions

  1. Call locator.inputValue({ timeout: 3000 }) with a plain literal or no options
  2. Precompute dynamic values; keep options plain data
  3. Avoid Proxies/accessors on browser API arguments
  4. try/catch the call for a clear failure path

Example fix

// before
await locator.inputValue(tracedOpts); // Proxy throws

// after
await locator.inputValue({ timeout: tracedOpts.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 value = await locator.inputValue(opts);
} catch (e) {
  throw new Error(`inputValue failed (inspect the options object for throwing accessors): ${e}`);
}

Prevention

When it happens

Trigger: Options with a raising getter on timeout/strict; Proxy-wrapped options with throwing get/ownKeys traps; a timeout whose coercion to number throws.

Common situations: Form-reading helpers that lazily resolve timeouts from config accessors; argument-tracing Proxies; class instances with accessor properties passed as options.

Related errors


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

Appendix: source

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

			copts, err := parseFrameTextContentOptions(rt, opts, lo.Timeout())
			if err != nil {
				return nil, fmt.Errorf("parsing text content options: %w", err)
			}
			return promise(vu, func() (any, error) {
				s, ok, err := lo.TextContent(copts)
				if err != nil {
					return nil, err //nolint:wrapcheck
				}
				if !ok {
					return nil, nil
				}
				return s, nil
			}), nil
		},
		"inputValue": func(opts sobek.Value) (*sobek.Promise, error) {
			copts, err := parseFrameInputValueOptions(rt, opts, lo.Timeout())
			if err != nil {
				return nil, fmt.Errorf("parsing input value options: %w", err)
			}
			return promise(vu, func() (any, error) {
				return lo.InputValue(copts) //nolint:wrapcheck
			}), nil
		},
		"selectOption": func(values sobek.Value, opts sobek.Value) (*sobek.Promise, error) {
			copts, err := parseFrameSelectOptionOptions(rt, opts, lo.Timeout())
			if err != nil {
				return nil, fmt.Errorf("parsing select option options: %w", err)
			}
			convValues, err := ConvertSelectOptionValues(vu.Runtime(), values)
			if err != nil {
				return nil, fmt.Errorf("parsing select option values: %w", err)
			}
			return promise(vu, func() (any, error) {
				return lo.SelectOption(convValues, copts) //nolint:wrapcheck
			}), nil
		},

View on GitHub (pinned to 8d06114777)