grafana/k6 · error

internal error while initializing frame %T

Error message

internal error while initializing frame %T: %w

What it means

During initOptions, one of the option-applying CDP actions (viewport, geolocation, color scheme, JS disabled, etc., collected in optActions) failed. The error is wrapped with the action's Go type identifying which option failed; option application is treated as mandatory, so the frame session setup aborts.

Solutions

  1. Identify the failing option from the wrapped action type and error
  2. Check that browser context options (viewport, geolocation, deviceScaleFactor...) hold valid values
  3. Update k6/Chromium; some options fail on older protocol versions
Defensive patterns

Strategy: try-catch

When it happens

Trigger: Thrown at internal/js/modules/k6/browser/common/frame_session.go:573 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/1ba0354f35c6be88. Report an issue: GitHub.

Appendix: source

Thrown at internal/js/modules/k6/browser/common/frame_session.go:626

		reqIntercept = true
	}
	if err := fs.updateRequestInterception(reqIntercept); err != nil {
		return err
	}

	if err := fs.updateOffline(true); err != nil {
		return err
	}
	if err := fs.updateHTTPCredentials(true); err != nil {
		return err
	}
	if err := fs.updateEmulateMedia(); err != nil {
		return err
	}

	for _, action := range optActions {
		if err := action.Do(cdp.WithExecutor(fs.ctx, fs.session)); err != nil {
			return fmt.Errorf("internal error while initializing frame %T: %w", action, err)
		}
	}

	return nil
}

func (fs *FrameSession) initRendererEvents() {
	fs.logger.Debugf("NewFrameSession:initEvents:initRendererEvents",
		"sid:%v tid:%v", fs.session.ID(), fs.targetID)

	events := []string{
		cdproto.EventLogEntryAdded,
		cdproto.EventPageFileChooserOpened,
		cdproto.EventPageFrameAttached,
		cdproto.EventPageFrameDetached,
		cdproto.EventPageFrameNavigated,
		cdproto.EventPageFrameRequestedNavigation,
		cdproto.EventPageFrameStartedLoading,

View on GitHub (pinned to 3fcf5388d7)