grafana/k6 · error

protocol error while initializing worker %T: %w

Error message

protocol error while initializing worker %T: %w

What it means

Error "protocol error while initializing worker %T: %w" thrown in grafana/k6.

Source

Thrown at internal/js/modules/k6/browser/common/worker.go:45

		targetID: id,
		url:      url,
	}
	if err := w.initEvents(); err != nil {
		return nil, err
	}

	return &w, nil
}

func (w *Worker) initEvents() error {
	actions := []Action{
		log.Enable(),
		network.Enable(),
		runtime.RunIfWaitingForDebugger(),
	}
	for _, action := range actions {
		if err := action.Do(cdp.WithExecutor(w.ctx, w.session)); err != nil {
			return fmt.Errorf("protocol error while initializing worker %T: %w", action, err)
		}
	}
	return nil
}

// URL returns the URL of the web worker.
func (w *Worker) URL() string {
	return w.url
}

View on GitHub (pinned to 93accf6570)

When it happens

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

Common situations: See trigger scenarios.


AI-assisted analysis of grafana/k6@93accf6570 (2026-08-15). Data as JSON: /api/errors/df6893d822080f8a. Report an issue: GitHub.