{"record":{"id":"2dc3fe45f8789b2f","repo":"grafana/k6","slug":"run-if-waiting-for-debugger-to-attach-w","errorCode":null,"errorMessage":"run if waiting for debugger to attach: %w","messagePattern":"run if waiting for debugger to attach: %w","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"internal/js/modules/k6/browser/common/frame_session.go","lineNumber":158,"sourceCode":"\t\tsession:              s,\n\t\tpage:                 p,\n\t\tparent:               parent,\n\t\tmanager:              p.frameManager,\n\t\ttargetID:             tid,\n\t\tcontextIDToContextMu: sync.Mutex{},\n\t\tcontextIDToContext:   make(map[cdpruntime.ExecutionContextID]*ExecutionContext),\n\t\tisolatedWorlds:       make(map[string]bool),\n\t\teventCh:              make(chan Event),\n\t\tchildSessions:        make(map[cdp.FrameID]*FrameSession),\n\t\tbufferedWebVitals:    make(map[webVitalKey]webVitalSample),\n\t\tvu:                   k6ext.GetVU(ctx),\n\t\tk6Metrics:            k6Metrics,\n\t\tlogger:               l,\n\t\thasUIWindow:          hasUIWindow,\n\t}\n\n\tif err := cdpruntime.RunIfWaitingForDebugger().Do(cdp.WithExecutor(fs.ctx, fs.session)); err != nil {\n\t\treturn nil, fmt.Errorf(\"run if waiting for debugger to attach: %w\", err)\n\t}\n\n\tvar parentNM *NetworkManager\n\tif fs.parent != nil {\n\t\tparentNM = fs.parent.networkManager\n\t}\n\tfs.networkManager, err = NewNetworkManager(ctx, k6Metrics, s, fs.manager, parentNM, fs.manager.page)\n\tif err != nil {\n\t\tl.Debugf(\"NewFrameSession:NewNetworkManager\", \"sid:%v tid:%v err:%v\",\n\t\t\ts.ID(), tid, err)\n\t\treturn nil, err\n\t}\n\n\t// When a frame creates a new FrameSession without UI (e.g. some iframes) we cannot\n\t// retrieve the windowID. Doing so would lead to an error from chromium. For now all\n\t// iframes that are attached are setup with hasUIWindow as false which seems to work\n\t// as expected for iframes with and without UI elements.\n\tif fs.hasUIWindow {","sourceCodeStart":140,"sourceCodeEnd":176,"githubUrl":"https://github.com/grafana/k6/blob/3fcf5388d78cb382f0c0d42ec556a06bfd1b8dee/internal/js/modules/k6/browser/common/frame_session.go#L140-L176","documentation":"During NewFrameSession setup, running Browser.setPauseOnStart (the 'run if waiting for debugger to attach' CDP option) failed. The wrapped error comes from Chromium over CDP; setup of the frame session aborts, so the page/iframe target cannot be used.","triggerScenarios":"Thrown at internal/js/modules/k6/browser/common/frame_session.go:129 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Inspect the wrapped CDP error for Chromium's reason","Update k6 and the bundled/used Chromium version — CDP protocol mismatches can cause this","Retry the test; transient CDP failures during attach can occur under load"],"exampleFix":null,"handlingStrategy":"try-catch","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"}