{"record":{"id":"f3ca296c7998d347","repo":"grafana/k6","slug":"mouse-up-w","errorCode":null,"errorMessage":"mouse up: %w","messagePattern":"mouse up: %w","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"internal/js/modules/k6/browser/common/mouse.go","lineNumber":112,"sourceCode":"\treturn nil\n}\n\n// Up will trigger a MouseUp event in the browser.\nfunc (m *Mouse) Up(opts *MouseDownUpOptions) error {\n\tif err := m.up(opts); err != nil {\n\t\treturn fmt.Errorf(\"releasing the mouse button on x:%f y:%f: %w\", m.x, m.y, err)\n\t}\n\treturn nil\n}\n\nfunc (m *Mouse) up(opts *MouseDownUpOptions) error {\n\tm.button = input.None\n\taction := input.DispatchMouseEvent(input.MouseReleased, m.x, m.y).\n\t\tWithButton(input.MouseButton(opts.Button)).\n\t\tWithModifiers(input.Modifier(m.keyboard.modifiers)).\n\t\tWithClickCount(opts.ClickCount)\n\tif err := action.Do(cdp.WithExecutor(m.ctx, m.session)); err != nil {\n\t\treturn fmt.Errorf(\"mouse up: %w\", err)\n\t}\n\n\treturn nil\n}\n\n// Move will trigger a MouseMoved event in the browser.\nfunc (m *Mouse) Move(x float64, y float64, opts *MouseMoveOptions) error {\n\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","sourceCodeStart":94,"sourceCodeEnd":130,"githubUrl":"https://github.com/grafana/k6/blob/93accf6570dcd306ca5e99cc44c393ee3797761b/internal/js/modules/k6/browser/common/mouse.go#L94-L130","documentation":"Root-level error from the internal Mouse.up(): the CDP Input.dispatchMouseEvent(mouseReleased) call itself failed. This is a raw Chrome DevTools Protocol failure, meaning the session or target is gone (page closed, browser crashed, connection dropped) rather than a problem with the release action itself.","triggerScenarios":"action.Do(cdp.WithExecutor(...)) for mouseReleased returning an error: DevTools websocket closed, target destroyed by navigation/close, browser process exit, or remote CDP connection failure.","commonSituations":"Browser killed by OOM mid-test; page closed between down and up; remote browser endpoint restarted; test code swallowing an earlier failure and continuing to drive a dead session.","solutions":["Verify the browser and page are still alive before the release call","Treat this error as session-lost: recreate the page (and Mouse) rather than retrying up() alone","Fix the root cause: memory limits for Chromium, fewer parallel pages, stable remote endpoint","Fail fast on earlier errors so input is never dispatched to a dead session"],"exampleFix":"// before\nawait page.mouse.up(); // on a possibly dead session\n\n// after\nif (page.isClosed()) throw new Error('cannot release mouse: page closed');\nawait page.mouse.up();","handlingStrategy":"try-catch","validationCode":"if (page.isClosed()) throw new Error('page closed');\nawait page.mouse.up();","typeGuard":null,"tryCatchPattern":"try {\n  await page.mouse.up();\n} catch (e) {\n  if (/target closed|connection refused|websocket/i.test(e.message)) {\n    throw new Error('CDP connection lost; browser likely dead');\n  }\n  throw e;\n}","preventionTips":["Watch for OOM kills of Chromium in container logs","Wrap whole gestures (down+move+up) so failures restart cleanly","Keep remote browser endpoints stable and version-matched"],"tags":["browser","cdp","mouse","protocol","crash"],"backgroundTag":null,"analyzedSha":"93accf6570dcd306ca5e99cc44c393ee3797761b","analyzedAt":"2026-08-15T21:23:27.118Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}