grafana/k6 · error

getting bounding box of

Error message

getting bounding box of %q: unexpected type %T

What it means

Returned by Frame.boundingBox as a type guard: the action pipeline returned a value for the bounding box that is not *Rect. Since handle.BoundingBox returns *Rect, this indicates an internal anomaly (wrong responder wired into the action), reported with the selector and actual Go type.

Solutions

  1. Report as a k6 browser module bug with a reproducing script
  2. Retry in case of a transient anomaly
Defensive patterns

Strategy: type-guard

When it happens

Trigger: Thrown at internal/js/modules/k6/browser/common/frame.go:586 when the library encounters an invalid state.

Common situations: See trigger scenarios.


AI-assisted analysis of grafana/k6@3fcf5388d7 (2026-08-18). Data as JSON: /api/errors/ee5142637e331b51. Report an issue: GitHub.

Appendix: source

Thrown at internal/js/modules/k6/browser/common/frame.go:594

	return handle, err
}

func (f *Frame) boundingBox(selector string, opts *FrameBaseOptions) (*Rect, error) {
	getBoundingBox := func(apiCtx context.Context, handle *ElementHandle) (any, error) {
		return handle.BoundingBox()
	}
	act := f.newAction(
		selector, DOMElementStateAttached, opts.Strict, getBoundingBox, []string{}, false, noRetry, true, opts.Timeout,
	)
	v, err := call(f.ctx, act, opts.Timeout)
	if err != nil {
		return nil, errorFromDOMError(err)
	}

	bv, ok := v.(*Rect)
	if !ok {
		return nil, fmt.Errorf("getting bounding box of %q: unexpected type %T", selector, v)
	}

	return bv, nil
}

// ChildFrames returns a list of child frames.
func (f *Frame) ChildFrames() []*Frame {
	f.childFramesMu.RLock()
	defer f.childFramesMu.RUnlock()

	l := make([]*Frame, 0, len(f.childFrames))
	for child := range f.childFrames {
		l = append(l, child)
	}
	return l
}

// Click clicks the first element found that matches selector.

View on GitHub (pinned to 3fcf5388d7)