grafana/k6 · error
internal error while enabling %T
Error message
internal error while enabling %T: %w
What it means
During initDomains, one of the initial CDP domain-enable actions (DOM.enable, Log.enable, Runtime.enable, Target.setAutoAttach) failed. These are prerequisites for frame session operation; the error is wrapped with the action's Go type identifying which domain failed. Marked 'internal error' because enable calls should not fail on a healthy session.
Solutions
- Inspect the wrapped CDP error to see which domain failed and why
- Update k6 and the Chromium version — CDP protocol mismatches can break domain enable
- Check browser startup logs for crashes or resource exhaustion
Defensive patterns
Strategy: try-catch
When it happens
Trigger: Thrown at internal/js/modules/k6/browser/common/frame_session.go:232 when the library encounters an invalid state.
Common situations: See trigger scenarios.
AI-assisted analysis of grafana/k6@3fcf5388d7 (2026-08-18).
Data as JSON: /api/errors/2a57f1048fd50cda.
Report an issue: GitHub.
Appendix: source
Thrown at internal/js/modules/k6/browser/common/frame_session.go:261
}
return nil
}
func (fs *FrameSession) getNetworkManager() *NetworkManager {
return fs.networkManager
}
func (fs *FrameSession) initDomains() error {
actions := []Action{
// TODO: can we get rid of the following by doing DOM related stuff in JS instead?
dom.Enable(),
cdplog.Enable(),
cdpruntime.Enable(),
target.SetAutoAttach(true, true).WithFlatten(true),
}
for _, action := range actions {
if err := action.Do(cdp.WithExecutor(fs.ctx, fs.session)); err != nil {
return fmt.Errorf("internal error while enabling %T: %w", action, err)
}
}
return nil
}
//nolint:cyclop,funlen
func (fs *FrameSession) initEvents() {
fs.logger.Debugf("NewFrameSession:initEvents",
"sid:%v tid:%v", fs.session.ID(), fs.targetID)
events := []string{
cdproto.EventInspectorTargetCrashed,
}
fs.session.on(fs.ctx, events, fs.eventCh)
if !fs.isMainFrame() {
fs.initRendererEvents()
}
View on GitHub (pinned to 3fcf5388d7)