{"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":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"internal/js/modules/k6/browser/browser/locator_mapping.go","lineNumber":349,"sourceCode":"\t\t\tcopts := common.NewFrameTextContentOptions(lo.Timeout())\n\t\t\tif err := copts.Parse(vu.Context(), opts); 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 := common.NewFrameInputValueOptions(lo.Timeout())\n\t\t\tif err := copts.Parse(vu.Context(), opts); 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 := common.NewFrameSelectOptionOptions(lo.Timeout())\n\t\t\tif err := copts.Parse(vu.Context(), opts); 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":331,"sourceCodeEnd":367,"githubUrl":"https://github.com/grafana/k6/blob/93accf6570dcd306ca5e99cc44c393ee3797761b/internal/js/modules/k6/browser/browser/locator_mapping.go#L331-L367","documentation":"Thrown when locator.inputValue(opts) cannot parse its options into FrameInputValueOptions (embeds FrameBaseOptions: strict boolean, timeout number in ms). The mapping wraps the cause as 'parsing input value options: %w'. The parse happens synchronously before the promise is created, so the error rejects immediately without touching the browser.","triggerScenarios":"Calling locator.inputValue('5s') or inputValue(5000) — scalar in the opts slot; passing a non-plain-object (array, function) as options; wrong-typed timeout under strict parsers.","commonSituations":"Reading form field values in load tests and passing durations as strings; argument slips like inputValue({ 'timeout': '1s' }); sharing one options constant across methods with different accepted keys.","solutions":["Call inputValue() bare or with { timeout: <number-ms> }","Use numbers, not duration strings, for timeout","Keep the options object a plain literal with only strict/timeout keys","Set default timeout on the locator once instead"],"exampleFix":"// before\nconst v = await page.locator('input[name=q]').inputValue('5s');\n\n// after\nconst v = await page.locator('input[name=q]').inputValue({ timeout: 5000 });","handlingStrategy":"validation","validationCode":"function assertBaseOpts(method, opts) {\n  if (opts === null || opts === undefined) return;\n  if (typeof opts !== 'object' || Array.isArray(opts)) {\n    throw new TypeError(`${method} options must be a plain object, got ${typeof opts}`);\n  }\n  if ('timeout' in opts && typeof opts.timeout !== 'number') {\n    throw new TypeError(`${method} timeout must be a number (ms)`);\n  }\n}\nassertBaseOpts('inputValue', opts);","typeGuard":"function isLocatorBaseOptions(v) {\n  if (v === null || v === undefined) return true;\n  if (typeof v !== 'object' || Array.isArray(v)) return false;\n  return (v.timeout === undefined || typeof v.timeout === 'number') &&\n         (v.strict === undefined || typeof v.strict === 'boolean');\n}","tryCatchPattern":"try {\n  const v = await locator.inputValue(opts);\n} catch (e) {\n  if (/parsing input value options/.test(String(e.message))) {\n    throw new Error(`Bad inputValue options: ${JSON.stringify(opts)}`);\n  }\n  throw e;\n}","preventionTips":["Read form values with bare inputValue() calls unless a custom timeout is required","Keep durations numeric in milliseconds","Centralize option construction instead of hand-writing per call"],"tags":["k6","browser","locator","options","inputvalue"],"backgroundTag":null,"analyzedSha":"93accf6570dcd306ca5e99cc44c393ee3797761b","analyzedAt":"2026-08-15T21:23:27.118Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}