grafana/k6 · error
could not find frame with id
Error message
could not find frame with id %s
What it means
Returned by Frame.position when the frame manager has no frame registered for the page's target ID — the lookup getFrameByID(cdp.FrameID(f.page.targetID)) failed. This means the page's own frame is untracked, indicating frame-tree desynchronization (e.g. during target teardown) rather than a bad argument.
Solutions
- Retry the position/boundingBox call after frame tree events settle
- Avoid measuring during navigation or page close
- Report if it persists on a stable page (frame-manager bug)
Defensive patterns
Strategy: retry
When it happens
Trigger: Thrown at internal/js/modules/k6/browser/common/frame.go:376 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/9e86ca93c2638319.
Report an issue: GitHub.
Appendix: source
Thrown at internal/js/modules/k6/browser/common/frame.go:381
f.loadingStartedTime = time.Now()
}
func (f *Frame) onLoadingStopped() {
f.log.Debugf("Frame:onLoadingStopped", "fid:%s furl:%q", f.ID(), f.URL())
// TODO: We should start a timer here and allow the user
// to set how long to wait until after onLoadingStopped
// has occurred. The reason we may want a timeout here
// are for websites where they perform many network
// requests so it may take a long time for us to see
// a networkIdle event or we may never see one if the
// website never stops performing network requests.
}
func (f *Frame) position() (*Position, error) {
frame, ok := f.manager.getFrameByID(cdp.FrameID(f.page.targetID))
if !ok {
return nil, fmt.Errorf("could not find frame with id %s", f.page.targetID)
}
if frame == f.page.frameManager.MainFrame() {
return &Position{X: 0, Y: 0}, nil
}
element, err := frame.FrameElement()
if err != nil {
return nil, err
}
box, err := element.BoundingBox()
if err != nil {
return nil, fmt.Errorf("finding position in frame: %w", err)
}
return &Position{X: box.X, Y: box.Y}, nil
}
func (f *Frame) removeChildFrame(child *Frame) {View on GitHub (pinned to 3fcf5388d7)