{"record":{"id":"d238db238795d8f6","repo":"grafana/k6","slug":"parsing-input-value-options-w-d238db","errorCode":null,"errorMessage":"parsing input value options: %w","messagePattern":"parsing input value options: %w","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"internal/js/modules/k6/browser/browser/locator_mapping.go","lineNumber":350,"sourceCode":"\t\t\tcopts, err := parseFrameTextContentOptions(rt, opts, lo.Timeout())\n\t\t\tif err != nil {\n\t\t\t\treturn nil, fmt.Errorf(\"parsing text content options: %w\", err)\n\t\t\t}\n\t\t\treturn promise(vu, func() (any, error) {\n\t\t\t\ts, ok, err := lo.TextContent(copts)\n\t\t\t\tif err != nil {\n\t\t\t\t\treturn nil, err //nolint:wrapcheck\n\t\t\t\t}\n\t\t\t\tif !ok {\n\t\t\t\t\treturn nil, nil\n\t\t\t\t}\n\t\t\t\treturn s, nil\n\t\t\t}), nil\n\t\t},\n\t\t\"inputValue\": func(opts sobek.Value) (*sobek.Promise, error) {\n\t\t\tcopts, err := parseFrameInputValueOptions(rt, opts, lo.Timeout())\n\t\t\tif err != nil {\n\t\t\t\treturn nil, fmt.Errorf(\"parsing input value options: %w\", err)\n\t\t\t}\n\t\t\treturn promise(vu, func() (any, error) {\n\t\t\t\treturn lo.InputValue(copts) //nolint:wrapcheck\n\t\t\t}), nil\n\t\t},\n\t\t\"selectOption\": func(values sobek.Value, opts sobek.Value) (*sobek.Promise, error) {\n\t\t\tcopts, err := parseFrameSelectOptionOptions(rt, opts, lo.Timeout())\n\t\t\tif err != nil {\n\t\t\t\treturn nil, fmt.Errorf(\"parsing select option options: %w\", err)\n\t\t\t}\n\t\t\tconvValues, err := ConvertSelectOptionValues(vu.Runtime(), values)\n\t\t\tif err != nil {\n\t\t\t\treturn nil, fmt.Errorf(\"parsing select option values: %w\", err)\n\t\t\t}\n\t\t\treturn promise(vu, func() (any, error) {\n\t\t\t\treturn lo.SelectOption(convValues, copts) //nolint:wrapcheck\n\t\t\t}), nil\n\t\t},","sourceCodeStart":332,"sourceCodeEnd":368,"githubUrl":"https://github.com/grafana/k6/blob/8d06114777191d21ef885d05c5f8aa9e1ed838ae/internal/js/modules/k6/browser/browser/locator_mapping.go#L332-L368","documentation":"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.","triggerScenarios":"Options with a raising getter on timeout/strict; Proxy-wrapped options with throwing get/ownKeys traps; a timeout whose coercion to number throws.","commonSituations":"Form-reading helpers that lazily resolve timeouts from config accessors; argument-tracing Proxies; class instances with accessor properties passed as options.","solutions":["Call locator.inputValue({ timeout: 3000 }) with a plain literal or no options","Precompute dynamic values; keep options plain data","Avoid Proxies/accessors on browser API arguments","try/catch the call for a clear failure path"],"exampleFix":"// before\nawait locator.inputValue(tracedOpts); // Proxy throws\n\n// after\nawait locator.inputValue({ timeout: tracedOpts.timeout });","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 value = await locator.inputValue(opts);\n} catch (e) {\n  throw new Error(`inputValue failed (inspect the options object for throwing accessors): ${e}`);\n}","preventionTips":["Call inputValue() bare when defaults suffice","Keep timeout as a plain number property","Never proxy option objects passed to the browser module"],"tags":["k6","browser","locator","inputvalue","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"}