{"record":{"id":"9e86ca93c2638319","repo":"grafana/k6","slug":"could-not-find-frame-with-id-s","errorCode":null,"errorMessage":"could not find frame with id %s","messagePattern":"could not find frame with id (.+?)","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"internal/js/modules/k6/browser/common/frame.go","lineNumber":381,"sourceCode":"\tf.loadingStartedTime = time.Now()\n}\n\nfunc (f *Frame) onLoadingStopped() {\n\tf.log.Debugf(\"Frame:onLoadingStopped\", \"fid:%s furl:%q\", f.ID(), f.URL())\n\n\t// TODO: We should start a timer here and allow the user\n\t//       to set how long to wait until after onLoadingStopped\n\t//       has occurred. The reason we may want a timeout here\n\t//       are for websites where they perform many network\n\t//       requests so it may take a long time for us to see\n\t//       a networkIdle event or we may never see one if the\n\t//       website never stops performing network requests.\n}\n\nfunc (f *Frame) position() (*Position, error) {\n\tframe, ok := f.manager.getFrameByID(cdp.FrameID(f.page.targetID))\n\tif !ok {\n\t\treturn nil, fmt.Errorf(\"could not find frame with id %s\", f.page.targetID)\n\t}\n\tif frame == f.page.frameManager.MainFrame() {\n\t\treturn &Position{X: 0, Y: 0}, nil\n\t}\n\telement, err := frame.FrameElement()\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tbox, err := element.BoundingBox()\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"finding position in frame: %w\", err)\n\t}\n\n\treturn &Position{X: box.X, Y: box.Y}, nil\n}\n\nfunc (f *Frame) removeChildFrame(child *Frame) {","sourceCodeStart":363,"sourceCodeEnd":399,"githubUrl":"https://github.com/grafana/k6/blob/3fcf5388d78cb382f0c0d42ec556a06bfd1b8dee/internal/js/modules/k6/browser/common/frame.go#L363-L399","documentation":"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.","triggerScenarios":"Thrown at internal/js/modules/k6/browser/common/frame.go:376 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","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)"],"exampleFix":null,"handlingStrategy":"retry","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"3fcf5388d78cb382f0c0d42ec556a06bfd1b8dee","analyzedAt":"2026-08-18T03:05:52.393Z","contentChangedAt":"2026-08-18T03:05:52.393Z","schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}