grafana/k6 · error

releasing the mouse button on x

Error message

releasing the mouse button on x:%f y:%f: %w

What it means

Wrapped failure from Mouse.up while releasing a mouse button at the current pointer position (m.x, m.y). Fires when the CDP Input.dispatchMouseEvent(MouseReleased) command fails, e.g. the session or target was closed while the button was held.

Solutions

  1. Release the button before closing or navigating the page
  2. Ensure the session is valid; pair every Down with an Up (defer the Up)
  3. Re-raise/inspect the wrapped CDP error for connection-level causes
Defensive patterns

Strategy: try-catch

When it happens

Trigger: Thrown at internal/js/modules/k6/browser/common/mouse.go:100 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/86fd34881b1df3a3. Report an issue: GitHub.

Appendix: source

Thrown at internal/js/modules/k6/browser/common/mouse.go:100

	return nil
}

func (m *Mouse) down(opts *MouseDownUpOptions) error {
	m.button = input.MouseButton(opts.Button)
	action := input.DispatchMouseEvent(input.MousePressed, 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 down: %w", err)
	}
	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.

View on GitHub (pinned to 01ffac6f24)