{"record":{"id":"d93b4fb59dbc5556","repo":"grafana/k6","slug":"mouse-move-w","errorCode":null,"errorMessage":"mouse move: %w","messagePattern":"mouse move: %w","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"internal/js/modules/k6/browser/common/mouse.go","lineNumber":138,"sourceCode":"\tif err := m.move(x, y, opts); err != nil {\n\t\treturn fmt.Errorf(\"moving the mouse pointer to x:%f y:%f: %w\", x, y, err)\n\t}\n\treturn nil\n}\n\nfunc (m *Mouse) move(x float64, y float64, opts *MouseMoveOptions) error {\n\tfromX := m.x\n\tfromY := m.y\n\tm.x = x\n\tm.y = y\n\tfor i := int64(1); i <= opts.Steps; i++ {\n\t\tx := fromX + (m.x-fromX)*float64(i/opts.Steps)\n\t\ty := fromY + (m.y-fromY)*float64(i/opts.Steps)\n\t\taction := input.DispatchMouseEvent(input.MouseMoved, x, y).\n\t\t\tWithButton(m.button).\n\t\t\tWithModifiers(input.Modifier(m.keyboard.modifiers))\n\t\tif err := action.Do(cdp.WithExecutor(m.ctx, m.session)); err != nil {\n\t\t\treturn fmt.Errorf(\"mouse move: %w\", err)\n\t\t}\n\t}\n\n\treturn nil\n}\n","sourceCodeStart":120,"sourceCodeEnd":144,"githubUrl":"https://github.com/grafana/k6/blob/01ffac6f245854c1b8adc6a69857c76a15f90022/internal/js/modules/k6/browser/common/mouse.go#L120-L144","documentation":"Low-level failure while dispatching the interpolated MouseMoved events from the old to the new coordinates over opts.Steps increments. Fires when a CDP dispatch fails partway through the path — session closed, context canceled, or browser input rejection — after the internal x/y were already updated.","triggerScenarios":"Thrown at internal/js/modules/k6/browser/common/mouse.go:138 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Ensure the session remains alive for the whole move sequence","Use a sane Steps value (>=1) in MouseMoveOptions","Treat the pointer position as updated-to-target even on failure, since state mutates first"],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"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"}