grafana/k6 · error
removing frames recursively: detaching frame
Error message
removing frames recursively: detaching frame: %w
What it means
Returned by FrameManager.removeFramesRecursively when frame.detach() fails for the frame being removed (the last step after its children were processed). The wrap distinguishes the detach step; the wrapped error is the CDP/context cleanup failure, often because the target was already destroyed.
Solutions
- Usually benign when the page/target is already closing; retry the outer operation
- Avoid closing pages concurrently with operations touching their frames
- Report if it fails on a live, stable page
Defensive patterns
Strategy: retry
When it happens
Trigger: Thrown at internal/js/modules/k6/browser/common/frame_manager.go:457 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/91fc5b037c65de3d.
Report an issue: GitHub.
Appendix: source
Thrown at internal/js/modules/k6/browser/common/frame_manager.go:457
}
}
return nil
}
func (m *FrameManager) removeFramesRecursively(frame *Frame) error {
for _, child := range frame.ChildFrames() {
m.logger.Debugf("FrameManager:removeFramesRecursively",
"fmid:%d cfid:%v pfid:%v cfname:%s cfurl:%s",
m.ID(), child.ID(), frame.ID(), child.Name(), child.URL())
if err := m.removeFramesRecursively(child); err != nil {
return fmt.Errorf("removing frames recursively: %w", err)
}
}
if err := frame.detach(); err != nil {
return fmt.Errorf("removing frames recursively: detaching frame: %w", err)
}
m.framesMu.Lock()
m.logger.Debugf("FrameManager:removeFramesRecursively:delParentFrame",
"fmid:%d fid:%v fname:%s furl:%s",
m.ID(), frame.ID(), frame.Name(), frame.URL())
delete(m.frames, cdp.FrameID(frame.ID()))
m.framesMu.Unlock()
return nil
}
func (m *FrameManager) requestFailed(req *Request, canceled bool) {
m.logger.Debugf("FrameManager:requestFailed", "fmid:%d rurl:%s", m.ID(), req.URL())
frame := req.getFrame()
if frame == nil {View on GitHub (pinned to 01ffac6f24)