grafana/k6 · error

emulating timezone

Error message

emulating timezone %q: %w

What it means

During initOptions, the Emulation.setTimezoneOverride CDP call failed while applying the browser context's configured timezone ID. Chromium rejected the timezone (invalid identifier) or the session was in a bad state; the error is wrapped with the timezone string.

Solutions

  1. Use a valid IANA timezone ID, e.g. 'America/New_York' or 'Europe/Berlin' (K6_BROWSER_TIMEZONE)
  2. Check the wrapped CDP error for Chromium's reason
  3. Remove the timezone option if not needed
Defensive patterns

Strategy: try-catch

When it happens

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

Appendix: source

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

func (fs *FrameSession) emulateLocale() error {
	action := emulation.SetLocaleOverride().WithLocale(fs.page.browserCtx.opts.Locale)
	if err := action.Do(cdp.WithExecutor(fs.ctx, fs.session)); err != nil {
		if strings.Contains(err.Error(), "Another locale override is already in effect") {
			return nil
		}
		return fmt.Errorf("emulating locale %q: %w", fs.page.browserCtx.opts.Locale, err)
	}
	return nil
}

func (fs *FrameSession) emulateTimezone() error {
	action := emulation.SetTimezoneOverride(fs.page.browserCtx.opts.TimezoneID)
	if err := action.Do(cdp.WithExecutor(fs.ctx, fs.session)); err != nil {
		if strings.Contains(err.Error(), "Timezone override is already in effect") {
			return nil
		}
		return fmt.Errorf("emulating timezone %q: %w", fs.page.browserCtx.opts.TimezoneID, err)
	}
	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 {

View on GitHub (pinned to 3fcf5388d7)