grafana/k6 · error
mouse up
Error message
mouse up: %w
What it means
Low-level failure of the CDP Input.dispatchMouseEvent(MouseReleased) command. The handler resets the tracked button to None before dispatch, so this error indicates the protocol executor rejected the release — closed session, gone target, or canceled context — not stale button state.
Solutions
- Check that the page/session is still connected before releasing
- Ensure Down/Up are issued within the same session lifetime
- Inspect the wrapped error for context cancellation (iteration teardown)
Defensive patterns
Strategy: try-catch
When it happens
Trigger: Thrown at internal/js/modules/k6/browser/common/mouse.go:112 when the library encounters an invalid state.
Common situations: See trigger scenarios.
AI-assisted analysis of grafana/k6@01ffac6f24 (2026-08-18).
Data as JSON: /api/errors/f3ca296c7998d347.
Report an issue: GitHub.
Appendix: source
Thrown at internal/js/modules/k6/browser/common/mouse.go:112
return nil
}
// Up will trigger a MouseUp event in the browser.
func (m *Mouse) Up(opts *MouseDownUpOptions) error {
if err := m.up(opts); err != nil {
return fmt.Errorf("releasing the mouse button on x:%f y:%f: %w", m.x, m.y, err)
}
return nil
}
func (m *Mouse) up(opts *MouseDownUpOptions) error {
m.button = input.None
action := input.DispatchMouseEvent(input.MouseReleased, m.x, m.y).
WithButton(input.MouseButton(opts.Button)).
WithModifiers(input.Modifier(m.keyboard.modifiers)).
WithClickCount(opts.ClickCount)
if err := action.Do(cdp.WithExecutor(m.ctx, m.session)); err != nil {
return fmt.Errorf("mouse up: %w", err)
}
return nil
}
// Move will trigger a MouseMoved event in the browser.
func (m *Mouse) Move(x float64, y float64, opts *MouseMoveOptions) error {
if err := m.move(x, y, opts); err != nil {
return fmt.Errorf("moving the mouse pointer to x:%f y:%f: %w", x, y, err)
}
return nil
}
func (m *Mouse) move(x float64, y float64, opts *MouseMoveOptions) error {
fromX := m.x
fromY := m.y
m.x = x
m.y = yView on GitHub (pinned to 01ffac6f24)