grafana/k6 · error
emulating locale
Error message
emulating locale %q: %w
What it means
During initOptions, the Emulation.setLocaleOverride CDP call failed while applying the browser context's configured locale. The only tolerated failure is 'Another locale override is already in effect', which is ignored; any other CDP error is returned wrapped with the locale string.
Solutions
- Check that the locale option (browser.newContext({ locale }) or K6_BROWSER_LOCALE) is a valid BCP-47 tag, e.g. 'en-US'
- Remove conflicting locale emulation set elsewhere
- Inspect the wrapped Chromium error for details
Defensive patterns
Strategy: try-catch
When it happens
Trigger: Thrown at internal/js/modules/k6/browser/common/frame_session.go:202 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/2eea06e563e45ea1.
Report an issue: GitHub.
Appendix: source
Thrown at internal/js/modules/k6/browser/common/frame_session.go:231
if err = fs.initDomains(); err != nil {
l.Debugf(
"NewFrameSession:initDomains",
"sid:%v tid:%v err:%v",
s.ID(), tid, err)
return nil, err
}
return &fs, nil
}
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
}View on GitHub (pinned to 3fcf5388d7)