{"record":{"id":"7ea73479147d20e5","repo":"grafana/k6","slug":"internal-error-while-adding-binding-to-page-w","errorCode":null,"errorMessage":"internal error while adding binding to page: %w","messagePattern":"internal error while adding binding to page: %w","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"internal/js/modules/k6/browser/common/page.go","lineNumber":361,"sourceCode":"\n\t\treturn nil, err\n\t}\n\tp.frameSessionsMu.Lock()\n\tp.frameSessions[cdp.FrameID(tid)] = p.mainFrameSession\n\tp.frameSessionsMu.Unlock()\n\tp.Mouse = NewMouse(ctx, s, p.frameManager.MainFrame(), bctx.timeoutSettings, p.Keyboard)\n\tp.Touchscreen = NewTouchscreen(ctx, s, p.Keyboard)\n\n\tp.initEvents()\n\n\taction := target.SetAutoAttach(true, true).WithFlatten(true)\n\tif err := action.Do(cdp.WithExecutor(p.ctx, p.session)); err != nil {\n\t\treturn nil, fmt.Errorf(\"internal error while auto attaching to browser pages: %w\", err)\n\t}\n\n\tadd := runtime.AddBinding(webVitalBinding)\n\tif err := add.Do(cdp.WithExecutor(p.ctx, p.session)); err != nil {\n\t\treturn nil, fmt.Errorf(\"internal error while adding binding to page: %w\", err)\n\t}\n\n\tif err := bctx.applyAllInitScripts(&p); err != nil {\n\t\treturn nil, fmt.Errorf(\"internal error while applying init scripts to page: %w\", err)\n\t}\n\n\treturn &p, nil\n}\n\nfunc (p *Page) initEvents() {\n\tp.logger.Debugf(\"Page:initEvents\",\n\t\t\"sid:%v tid:%v\", p.session.ID(), p.targetID)\n\n\tevents := []string{\n\t\tcdproto.EventRuntimeConsoleAPICalled,\n\t}\n\tp.session.on(p.ctx, events, p.eventCh)\n","sourceCodeStart":343,"sourceCodeEnd":379,"githubUrl":"https://github.com/grafana/k6/blob/3fcf5388d78cb382f0c0d42ec556a06bfd1b8dee/internal/js/modules/k6/browser/common/page.go#L343-L379","documentation":"Failure of the CDP runtime.addBinding command during page creation, which installs the JavaScript binding used to collect web vitals from the page. Internal setup error: the session rejected the binding command, so the page cannot report web vitals.","triggerScenarios":"Thrown at internal/js/modules/k6/browser/common/page.go:359 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Retry page creation if the CDP session raced with browser startup","Ensure the browser binary/version supports runtime.addBinding","Report reproducible failures on healthy browsers as a k6/browser issue"],"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"}