{"record":{"id":"290dee407694053c","repo":"grafana/k6","slug":"throttling-network-w","errorCode":null,"errorMessage":"throttling network: %w","messagePattern":"throttling network: %w","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"internal/js/modules/k6/browser/common/network_manager.go","lineNumber":1082,"sourceCode":"\treturn nil\n}\n\n// ThrottleNetwork changes the network attributes in chrome to simulate slower\n// networks e.g. a slow 3G connection.\nfunc (m *NetworkManager) ThrottleNetwork(networkProfile NetworkProfile) error {\n\tif m.networkProfile == networkProfile {\n\t\treturn nil\n\t}\n\tm.networkProfile = networkProfile\n\n\taction := network.EmulateNetworkConditions(\n\t\tm.offline,\n\t\tm.networkProfile.Latency,\n\t\tm.networkProfile.Download,\n\t\tm.networkProfile.Upload,\n\t)\n\tif err := action.Do(cdp.WithExecutor(m.ctx, m.session)); err != nil {\n\t\treturn fmt.Errorf(\"throttling network: %w\", err)\n\t}\n\n\treturn nil\n}\n\n// SetUserAgent overrides the browser user agent string.\nfunc (m *NetworkManager) SetUserAgent(userAgent string) {\n\taction := emulation.SetUserAgentOverride(userAgent)\n\tif err := action.Do(cdp.WithExecutor(m.ctx, m.session)); err != nil {\n\t\tk6ext.Panicf(m.ctx, \"setting user agent: %w\", err)\n\t}\n}\n\n// SetCacheEnabled toggles cache on/off.\nfunc (m *NetworkManager) SetCacheEnabled(enabled bool) {\n\tm.userCacheDisabled = !enabled\n\tif err := m.updateProtocolCacheDisabled(); err != nil {\n\t\tk6ext.Panicf(m.ctx, \"%v\", err)","sourceCodeStart":1064,"sourceCodeEnd":1100,"githubUrl":"https://github.com/grafana/k6/blob/8d06114777191d21ef885d05c5f8aa9e1ed838ae/internal/js/modules/k6/browser/common/network_manager.go#L1064-L1100","documentation":"Failure of the CDP Network.emulateNetworkConditions command while applying a new network throttling profile (latency, download, upload throughput). No-op if the profile is unchanged; the error means the browser rejected the emulation — typically a dead session or invalid profile values.","triggerScenarios":"Thrown at internal/js/modules/k6/browser/common/network_manager.go:1082 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Use one of the documented NetworkProfile presets or plausible non-negative values","Apply throttling on a live page session","Retry after re-establishing the page if the command raced with teardown"],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"8d06114777191d21ef885d05c5f8aa9e1ed838ae","analyzedAt":"2026-08-18T03:05:52.393Z","contentChangedAt":"2026-08-18T03:05:52.393Z","schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}