grafana/k6 · error

initializing networking %T

Error message

initializing networking %T: %w

What it means

Failure while enabling the CDP Network domain (and, when request interception is active, disabling cache and enabling Fetch with the catch-all pattern) during NetworkManager initialization. Indicates the DevTools session rejected a domain-enable command — closed target, protocol error, or browser startup issue — not a script-level mistake.

Solutions

  1. Verify the browser launched successfully and the target is reachable
  2. Retry browser/page creation — transient CDP failures can occur during startup
  3. Check for browser crashes or resource exhaustion (too many concurrent browsers)
Defensive patterns

Strategy: try-catch

When it happens

Trigger: Thrown at internal/js/modules/k6/browser/common/network_manager.go:376 when the library encounters an invalid state.

Common situations: See trigger scenarios.


AI-assisted analysis of grafana/k6@8d06114777 (2026-08-18). Data as JSON: /api/errors/652a9a068315e6e4. Report an issue: GitHub.

Appendix: source

Thrown at internal/js/modules/k6/browser/common/network_manager.go:376

	m.eventInterceptor.onResponse(resp)
	m.eventInterceptor.onRequestFinished(req)
	m.emit(cdproto.EventNetworkResponseReceived, resp)
	m.emit(cdproto.EventNetworkLoadingFinished, req)
}

func (m *NetworkManager) initDomains() error {
	actions := []Action{network.Enable()}

	// Only enable the Fetch domain if necessary, as it has a performance overhead.
	if m.userReqInterceptionEnabled {
		actions = append(actions,
			network.SetCacheDisabled(true),
			fetch.Enable().WithPatterns([]*fetch.RequestPattern{{URLPattern: "*"}}))
	}
	for _, action := range actions {
		if err := action.Do(cdp.WithExecutor(m.ctx, m.session)); err != nil {
			return fmt.Errorf("initializing networking %T: %w", action, err)
		}
	}

	return nil
}

func (m *NetworkManager) initEvents() {
	chHandler := make(chan Event)
	m.session.on(m.ctx, []string{
		cdproto.EventNetworkLoadingFailed,
		cdproto.EventNetworkLoadingFinished,
		cdproto.EventNetworkRequestWillBeSent,
		cdproto.EventNetworkRequestWillBeSentExtraInfo,
		cdproto.EventNetworkRequestServedFromCache,
		cdproto.EventNetworkResponseReceived,
		cdproto.EventNetworkResponseReceivedExtraInfo,
		cdproto.EventFetchRequestPaused,
		cdproto.EventFetchAuthRequired,

View on GitHub (pinned to 8d06114777)