{"record":{"id":"652a9a068315e6e4","repo":"grafana/k6","slug":"initializing-networking-t-w","errorCode":null,"errorMessage":"initializing networking %T: %w","messagePattern":"initializing networking %T: %w","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"internal/js/modules/k6/browser/common/network_manager.go","lineNumber":376,"sourceCode":"\n\tm.eventInterceptor.onResponse(resp)\n\tm.eventInterceptor.onRequestFinished(req)\n\tm.emit(cdproto.EventNetworkResponseReceived, resp)\n\tm.emit(cdproto.EventNetworkLoadingFinished, req)\n}\n\nfunc (m *NetworkManager) initDomains() error {\n\tactions := []Action{network.Enable()}\n\n\t// Only enable the Fetch domain if necessary, as it has a performance overhead.\n\tif m.userReqInterceptionEnabled {\n\t\tactions = append(actions,\n\t\t\tnetwork.SetCacheDisabled(true),\n\t\t\tfetch.Enable().WithPatterns([]*fetch.RequestPattern{{URLPattern: \"*\"}}))\n\t}\n\tfor _, action := range actions {\n\t\tif err := action.Do(cdp.WithExecutor(m.ctx, m.session)); err != nil {\n\t\t\treturn fmt.Errorf(\"initializing networking %T: %w\", action, err)\n\t\t}\n\t}\n\n\treturn nil\n}\n\nfunc (m *NetworkManager) initEvents() {\n\tchHandler := make(chan Event)\n\tm.session.on(m.ctx, []string{\n\t\tcdproto.EventNetworkLoadingFailed,\n\t\tcdproto.EventNetworkLoadingFinished,\n\t\tcdproto.EventNetworkRequestWillBeSent,\n\t\tcdproto.EventNetworkRequestWillBeSentExtraInfo,\n\t\tcdproto.EventNetworkRequestServedFromCache,\n\t\tcdproto.EventNetworkResponseReceived,\n\t\tcdproto.EventNetworkResponseReceivedExtraInfo,\n\t\tcdproto.EventFetchRequestPaused,\n\t\tcdproto.EventFetchAuthRequired,","sourceCodeStart":358,"sourceCodeEnd":394,"githubUrl":"https://github.com/grafana/k6/blob/93accf6570dcd306ca5e99cc44c393ee3797761b/internal/js/modules/k6/browser/common/network_manager.go#L358-L394","documentation":"Thrown from NetworkManager.initDomains when a CDP domain-enabling command fails during page setup: network.Enable(), or — when request interception is on — network.SetCacheDisabled(true) plus fetch.Enable(). The %T names the exact action that failed. It almost always means the DevTools session/target was unusable: browser crashed, page closed mid-setup, or a protocol/version mismatch.","triggerScenarios":"Opening a new page while the browser process has crashed or is OOM; the target is destroyed during context creation; enabling the Fetch domain fails because interception (K6_BROWSER_... routing/hosts features) requires protocol support the connected Chromium does not implement; version mismatch when pointing K6_BROWSER_EXECUTABLE_PATH at an incompatible Chrome build.","commonSituations":"High VU counts spawning many pages until Chromium dies; constrained container memory; using an external/oversized Chrome with a cdproto version skew; CI runners where the browser binary is missing dependencies and dies instantly.","solutions":["Reproduce with a single VU to rule out resource exhaustion; check Chromium process/container logs and memory limits","If using an external browser, remove K6_BROWSER_EXECUTABLE_PATH to test with the bundled Chromium, or update to a compatible version","Reduce browser-level parallelism (scenarios, VUs, pages per iteration)","Upgrade k6 so the vendored chromedp/cdproto matches current Chromium releases"],"exampleFix":"# before: pinned old external chrome, many pages\nK6_BROWSER_EXECUTABLE_PATH=/usr/bin/chrome-old k6 run -u 50 browser.js\n\n# after: bundled chromium, single-VU reproduction to isolate\nk6 run -u 1 browser.js","handlingStrategy":"retry","validationCode":"// smoke-test browser health before the workload\nimport browser from 'k6/browser';\n\nexport default async function () {\n  const ctx = await browser.newContext();\n  const p = await ctx.newPage(); // fails here if domains can't initialize\n  await p.close();\n  await ctx.close();\n}","typeGuard":null,"tryCatchPattern":"try {\n  const page = await ctx.newPage();\n} catch (e) {\n  if (/initializing networking/i.test(e.message)) {\n    // browser/target unusable: recreate context once, then abort with diagnostics\n    throw new Error(`browser networking init failed: ${e.message}`);\n  }\n  throw e;\n}","preventionTips":["Run a 1-VU smoke scenario before full browser load","Set container memory limits with headroom for Chromium","Pin to the bundled Chromium unless an external one is verified compatible","Upgrade k6 regularly so cdproto tracks Chromium protocol changes"],"tags":["browser","cdp","network","crash","setup","memory"],"backgroundTag":null,"analyzedSha":"93accf6570dcd306ca5e99cc44c393ee3797761b","analyzedAt":"2026-08-15T21:23:27.118Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}