{"record":{"id":"5c7a526ec32b6b29","repo":"grafana/k6","slug":"parsing-element-fill-options-w","errorCode":null,"errorMessage":"parsing element fill options: %w","messagePattern":"parsing element fill options: %w","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"internal/js/modules/k6/browser/browser/element_handle_mapping.go","lineNumber":74,"sourceCode":"\t\t},\n\t\t\"dblclick\": func(opts sobek.Value) (*sobek.Promise, error) {\n\t\t\tpopts := common.NewElementHandleDblclickOptions(eh.DefaultTimeout())\n\t\t\tif err := popts.Parse(vu.Context(), opts); err != nil {\n\t\t\t\treturn nil, fmt.Errorf(\"parsing element double click options: %w\", err)\n\t\t\t}\n\t\t\treturn promise(vu, func() (any, error) {\n\t\t\t\treturn nil, eh.Dblclick(popts) //nolint:wrapcheck\n\t\t\t}), nil\n\t\t},\n\t\t\"dispatchEvent\": func(typ string, eventInit sobek.Value) *sobek.Promise {\n\t\t\treturn promise(vu, func() (any, error) {\n\t\t\t\treturn nil, eh.DispatchEvent(typ, exportArg(eventInit)) //nolint:wrapcheck\n\t\t\t})\n\t\t},\n\t\t\"fill\": func(value string, opts sobek.Value) (*sobek.Promise, error) {\n\t\t\tpopts := common.NewElementHandleBaseOptions(eh.DefaultTimeout())\n\t\t\tif err := popts.Parse(vu.Context(), opts); err != nil {\n\t\t\t\treturn nil, fmt.Errorf(\"parsing element fill options: %w\", err)\n\t\t\t}\n\t\t\treturn promise(vu, func() (any, error) {\n\t\t\t\treturn nil, eh.Fill(value, popts) //nolint:wrapcheck\n\t\t\t}), nil\n\t\t},\n\t\t\"focus\": func() *sobek.Promise {\n\t\t\treturn promise(vu, func() (any, error) {\n\t\t\t\treturn nil, eh.Focus() //nolint:wrapcheck\n\t\t\t})\n\t\t},\n\t\t\"getAttribute\": func(name string) *sobek.Promise {\n\t\t\treturn promise(vu, func() (any, error) {\n\t\t\t\ts, ok, err := eh.GetAttribute(name)\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","sourceCodeStart":56,"sourceCodeEnd":92,"githubUrl":"https://github.com/grafana/k6/blob/93accf6570dcd306ca5e99cc44c393ee3797761b/internal/js/modules/k6/browser/browser/element_handle_mapping.go#L56-L92","documentation":"Thrown synchronously by ElementHandle.fill() when its options object fails to parse. fill() parses common.ElementHandleBaseOptions (force, noWaitAfter, timeout), whose Parse in common/element_handle_options.go only performs lenient coercions and always returns nil in current k6, so this wrap is defensive and effectively unreachable today. If you do see it, you are likely on an older xk6-browser build where base-option parsing was structural, or hitting a regression.","triggerScenarios":"In current code, none: any value for force/noWaitAfter/timeout is coerced (ToBoolean/ToInteger) and unknown keys are ignored. Historically, passing a non-object options value whose fields failed structural export produced this error.","commonSituations":"Running scripts written against old xk6-browser versions (pre k6 v0.4x browser module GA) on a newer binary or vice versa; misattributing a fill() failure to options when the real error (e.g. element not an input) happens later inside the promise.","solutions":["Keep the options object to the documented keys: { force: true|false, noWaitAfter: true|false, timeout: <ms number> }","Ensure timeout is a number of milliseconds, not a string like '5s' (strings coerce to 0 or NaN, silently changing behavior)","If the error persists, reproduce with a minimal options object and report the k6 version, since current Parse cannot fail here","Check the wrapped cause after the colon: it identifies which field actually failed in your k6 build"],"exampleFix":"// before\nawait el.fill('hello', { timeout: '5s', force: 'yes' });\n\n// after\nawait el.fill('hello', { timeout: 5000, force: true });","handlingStrategy":"try-catch","validationCode":"const ALLOWED = new Set(['force', 'noWaitAfter', 'timeout']);\nconst bad = Object.keys(opts || {}).filter(k => !ALLOWED.has(k));\nif (bad.length) console.warn(`fill(): ignoring unsupported options: ${bad.join(', ')}`);\nif (opts?.timeout !== undefined && !Number.isFinite(Number(opts.timeout))) {\n  throw new Error('fill(): timeout must be a number of milliseconds');\n}","typeGuard":"function isFillOpts(o) {\n  if (o == null) return true;\n  return (o.force === undefined || typeof o.force === 'boolean') &&\n         (o.noWaitAfter === undefined || typeof o.noWaitAfter === 'boolean') &&\n         (o.timeout === undefined || Number.isFinite(o.timeout));\n}","tryCatchPattern":"try {\n  await el.fill('hello', opts);\n} catch (e) {\n  if (/parsing element fill options/.test(String(e.message))) {\n    console.log(`fix fill options: ${e.message}`); // current k6 cannot raise this; check version\n  } else throw e;\n}","preventionTips":["Pass timeout as milliseconds (5000, not '5s'); strings coerce to wrong values silently","Current k6 cannot fail this parse, so seeing it signals an old binary or regression: pin/upgrade k6 deliberately","Note unknown keys are ignored: review fill option names manually since typos never error"],"tags":["k6","browser","element-handle","fill","option-parsing"],"backgroundTag":null,"analyzedSha":"93accf6570dcd306ca5e99cc44c393ee3797761b","analyzedAt":"2026-08-15T21:23:27.118Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}