{"record":{"id":"753dc3d384f6aa6f","repo":"grafana/k6","slug":"updating-offline-mode-for-frame-v-w","errorCode":null,"errorMessage":"updating offline mode for frame %v: %w","messagePattern":"updating offline mode for frame (.+?): %w","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"internal/js/modules/k6/browser/common/frame_session.go","lineNumber":1251,"sourceCode":"\nfunc (fs *FrameSession) updateHTTPCredentials(initial bool) error {\n\tfs.logger.Debugf(\"NewFrameSession:updateHttpCredentials\", \"sid:%v tid:%v\", fs.session.ID(), fs.targetID)\n\n\tcredentials := fs.page.browserCtx.opts.HTTPCredentials\n\tif !initial || !credentials.IsEmpty() {\n\t\treturn fs.networkManager.Authenticate(credentials)\n\t}\n\n\treturn nil\n}\n\nfunc (fs *FrameSession) updateOffline(initial bool) error {\n\tfs.logger.Debugf(\"NewFrameSession:updateOffline\", \"sid:%v tid:%v\", fs.session.ID(), fs.targetID)\n\n\toffline := fs.page.browserCtx.opts.Offline\n\tif !initial || offline {\n\t\tif err := fs.networkManager.SetOfflineMode(offline); err != nil {\n\t\t\treturn fmt.Errorf(\"updating offline mode for frame %v: %w\", fs.targetID, err)\n\t\t}\n\t}\n\n\treturn nil\n}\n\nfunc (fs *FrameSession) throttleNetwork(networkProfile NetworkProfile) error {\n\tfs.logger.Debugf(\"NewFrameSession:throttleNetwork\", \"sid:%v tid:%v\", fs.session.ID(), fs.targetID)\n\n\treturn fs.networkManager.ThrottleNetwork(networkProfile)\n}\n\nfunc (fs *FrameSession) throttleCPU(cpuProfile CPUProfile) error {\n\taction := emulation.SetCPUThrottlingRate(cpuProfile.Rate)\n\tif err := action.Do(cdp.WithExecutor(fs.ctx, fs.session)); err != nil {\n\t\treturn fmt.Errorf(\"throttling CPU: %w\", err)\n\t}\n","sourceCodeStart":1233,"sourceCodeEnd":1269,"githubUrl":"https://github.com/grafana/k6/blob/3fcf5388d78cb382f0c0d42ec556a06bfd1b8dee/internal/js/modules/k6/browser/common/frame_session.go#L1233-L1269","documentation":"Wrap of a NetworkManager.SetOfflineMode failure for a specific frame target: updateOffline reads the browser context's Offline option and, when it is set (or on non-initial updates), toggles the CDP Network.emulateNetworkConditions state. The error fires when the emulate-network command is rejected — most commonly because the frame's session was already detached during navigation or the browser target crashed. The %v is the frame's target ID.","triggerScenarios":"Thrown at internal/js/modules/k6/browser/common/frame_session.go:1193 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Confirm the frame still exists and its CDP session is attached before toggling offline mode","Apply the offline option at browser-context creation instead of changing it mid-navigation","Retry the operation after the page finishes navigating","Check browser logs if every emulateNetworkConditions call fails, indicating a protocol/version mismatch"],"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"}