{"record":{"id":"2eea06e563e45ea1","repo":"grafana/k6","slug":"emulating-locale-q-w","errorCode":null,"errorMessage":"emulating locale %q: %w","messagePattern":"emulating locale %q: %w","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"internal/js/modules/k6/browser/common/frame_session.go","lineNumber":231,"sourceCode":"\tif err = fs.initDomains(); err != nil {\n\t\tl.Debugf(\n\t\t\t\"NewFrameSession:initDomains\",\n\t\t\t\"sid:%v tid:%v err:%v\",\n\t\t\ts.ID(), tid, err)\n\n\t\treturn nil, err\n\t}\n\n\treturn &fs, nil\n}\n\nfunc (fs *FrameSession) emulateLocale() error {\n\taction := emulation.SetLocaleOverride().WithLocale(fs.page.browserCtx.opts.Locale)\n\tif err := action.Do(cdp.WithExecutor(fs.ctx, fs.session)); err != nil {\n\t\tif strings.Contains(err.Error(), \"Another locale override is already in effect\") {\n\t\t\treturn nil\n\t\t}\n\t\treturn fmt.Errorf(\"emulating locale %q: %w\", fs.page.browserCtx.opts.Locale, err)\n\t}\n\treturn nil\n}\n\nfunc (fs *FrameSession) emulateTimezone() error {\n\taction := emulation.SetTimezoneOverride(fs.page.browserCtx.opts.TimezoneID)\n\tif err := action.Do(cdp.WithExecutor(fs.ctx, fs.session)); err != nil {\n\t\tif strings.Contains(err.Error(), \"Timezone override is already in effect\") {\n\t\t\treturn nil\n\t\t}\n\t\treturn fmt.Errorf(\"emulating timezone %q: %w\", fs.page.browserCtx.opts.TimezoneID, err)\n\t}\n\treturn nil\n}\n\nfunc (fs *FrameSession) getNetworkManager() *NetworkManager {\n\treturn fs.networkManager\n}","sourceCodeStart":213,"sourceCodeEnd":249,"githubUrl":"https://github.com/grafana/k6/blob/3fcf5388d78cb382f0c0d42ec556a06bfd1b8dee/internal/js/modules/k6/browser/common/frame_session.go#L213-L249","documentation":"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.","triggerScenarios":"Thrown at internal/js/modules/k6/browser/common/frame_session.go:202 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","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"],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"3fcf5388d78cb382f0c0d42ec556a06bfd1b8dee","analyzedAt":"2026-08-18T03:05:52.393Z","contentChangedAt":"2026-08-18T03:05:52.393Z","schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}