{"record":{"id":"92685cb364a18bc8","repo":"grafana/k6","slug":"parsing-mouse-double-click-options-w","errorCode":null,"errorMessage":"parsing mouse double click options: %w","messagePattern":"parsing mouse double click options: %w","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"internal/js/modules/k6/browser/browser/mouse_mapping.go","lineNumber":28,"sourceCode":"\tk6common \"go.k6.io/k6/v2/js/common\"\n)\n\nfunc mapMouse(vu moduleVU, m *common.Mouse) mapping {\n\trt := vu.Runtime()\n\treturn mapping{\n\t\t\"click\": func(x float64, y float64, opts sobek.Value) (*sobek.Promise, error) {\n\t\t\tpopts, err := parseMouseClickOptions(rt, opts)\n\t\t\tif err != nil {\n\t\t\t\treturn nil, fmt.Errorf(\"parsing mouse click options: %w\", err)\n\t\t\t}\n\t\t\treturn promise(vu, func() (any, error) {\n\t\t\t\treturn nil, m.Click(x, y, popts) //nolint:wrapcheck\n\t\t\t}), nil\n\t\t},\n\t\t\"dblClick\": func(x float64, y float64, opts sobek.Value) (*sobek.Promise, error) {\n\t\t\tpopts, err := parseMouseDblClickOptions(rt, opts)\n\t\t\tif err != nil {\n\t\t\t\treturn nil, fmt.Errorf(\"parsing mouse double click options: %w\", err)\n\t\t\t}\n\t\t\treturn promise(vu, func() (any, error) {\n\t\t\t\treturn nil, m.DblClick(x, y, popts) //nolint:wrapcheck\n\t\t\t}), nil\n\t\t},\n\t\t\"down\": func(opts sobek.Value) (*sobek.Promise, error) {\n\t\t\tpopts, err := parseMouseDownUpOptions(rt, opts)\n\t\t\tif err != nil {\n\t\t\t\treturn nil, fmt.Errorf(\"parsing mouse down options: %w\", err)\n\t\t\t}\n\t\t\treturn promise(vu, func() (any, error) {\n\t\t\t\treturn nil, m.Down(popts) //nolint:wrapcheck\n\t\t\t}), nil\n\t\t},\n\t\t\"up\": func(opts sobek.Value) (*sobek.Promise, error) {\n\t\t\tpopts, err := parseMouseDownUpOptions(rt, opts)\n\t\t\tif err != nil {\n\t\t\t\treturn nil, fmt.Errorf(\"parsing mouse up options: %w\", err)","sourceCodeStart":10,"sourceCodeEnd":46,"githubUrl":"https://github.com/grafana/k6/blob/01ffac6f245854c1b8adc6a69857c76a15f90022/internal/js/modules/k6/browser/browser/mouse_mapping.go#L10-L46","documentation":"Thrown by mouse.dblClick(x, y, options) when parseMouseDblClickOptions fails. The double-click parser (browser/mouse_mapping.go:101-118) accepts only 'button' (string) and 'delay' (integer); a non-integer delay or a non-object options value is wrapped with this message before any input event is dispatched.","triggerScenarios":"page.mouse().dblClick(10, 20, { delay: '100' }), { delay: 100.5 }, or a non-object third argument. Passing 'clickCount' is silently ignored here (double click fixes the count), so delay type errors dominate.","commonSituations":"Delay injected from environment/config as a string (COMMA separated env parsing); float delays from pacing calculations; copy-paste between click and dblClick option objects that carried a string delay.","solutions":["Pass an integer delay: { delay: 100 } or omit it for zero delay.","Coerce and round: { delay: Math.round(Number(cfg.delay)) } with an is-integer check.","Keep 'button' a string among 'left' | 'right' | 'middle'.","Do not reuse mouse.click option objects verbatim if their delay is not an integer."],"exampleFix":"// before\nawait page.mouse().dblClick(10, 20, { delay: cfg.pauseMs }); // \"120\"\n\n// after\nawait page.mouse().dblClick(10, 20, { delay: Number(cfg.pauseMs) | 0 });","handlingStrategy":"validation","validationCode":"const opts = cfg.delay == null ? {} : { delay: Math.round(Number(cfg.delay)) };\nif (opts.delay != null && !Number.isInteger(opts.delay)) throw new Error('delay must be an integer');\nawait page.mouse().dblClick(x, y, opts);","typeGuard":"function isDblClickOptions(o) {\n  if (o == null) return true;\n  if (typeof o !== 'object') return false;\n  return (o.delay == null || Number.isInteger(o.delay)) && (o.button == null || typeof o.button === 'string');\n}","tryCatchPattern":"try { await page.mouse().dblClick(x, y, opts); } catch (e) { if (/parsing mouse double click options|delay must be an integer/.test(e.message)) { await page.mouse().dblClick(x, y, { ...opts, delay: Math.round(Number(opts.delay)) }); } else throw e; }","preventionTips":["Keep dblClick options to { button?: string; delay?: integer }.","Never pass a string delay from env/config without Number() conversion.","Round fractional pacing delays before use."],"tags":["k6","browser","mouse","double-click","options-parsing"],"backgroundTag":"invalid-options-argument","analyzedSha":"01ffac6f245854c1b8adc6a69857c76a15f90022","analyzedAt":"2026-08-18T03:05:52.393Z","contentChangedAt":"2026-08-18T03:05:52.393Z","schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}