{"record":{"id":"cc241d1ef88d9d6b","repo":"grafana/k6","slug":"error-setting-up-logger-w","errorCode":null,"errorMessage":"error setting up logger: %w","messagePattern":"error setting up logger: %w","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"internal/js/modules/k6/browser/chromium/browser_type.go","lineNumber":82,"sourceCode":"// on randSrc (used in initContext) and on the Ctx field (written in Connect).\nfunc (b *BrowserType) Clone() *BrowserType {\n\treturn &BrowserType{\n\t\tvu:           b.vu,\n\t\thooks:        b.hooks,\n\t\tk6Metrics:    b.k6Metrics,\n\t\trandSrc:      rand.New(rand.NewSource(time.Now().UnixNano())), //nolint: gosec\n\t\tenvLookupper: b.envLookupper,\n\t}\n}\n\nfunc (b *BrowserType) init(\n\tctx context.Context, isRemoteBrowser bool, scenarioOpts map[string]any,\n) (context.Context, *common.BrowserOptions, *log.Logger, error) {\n\tctx = b.initContext(ctx)\n\n\tlogger, err := makeLogger(ctx, b.envLookupper)\n\tif err != nil {\n\t\treturn nil, nil, nil, fmt.Errorf(\"error setting up logger: %w\", err)\n\t}\n\n\tvar browserOpts *common.BrowserOptions\n\tif isRemoteBrowser {\n\t\tbrowserOpts = common.NewRemoteBrowserOptions()\n\t} else {\n\t\tbrowserOpts = common.NewLocalBrowserOptions()\n\t}\n\n\tif err = browserOpts.Parse(ctx, logger, scenarioOpts, b.envLookupper); err != nil {\n\t\treturn nil, nil, nil, fmt.Errorf(\"error parsing browser options: %w\", err)\n\t}\n\tctx = common.WithBrowserOptions(ctx, browserOpts)\n\n\tif err := logger.SetCategoryFilter(browserOpts.LogCategoryFilter); err != nil {\n\t\treturn nil, nil, nil, fmt.Errorf(\"error setting category filter: %w\", err)\n\t}\n\tif browserOpts.Debug {","sourceCodeStart":64,"sourceCodeEnd":100,"githubUrl":"https://github.com/grafana/k6/blob/8d06114777191d21ef885d05c5f8aa9e1ed838ae/internal/js/modules/k6/browser/chromium/browser_type.go#L64-L100","documentation":"makeLogger failed while initializing the browser module's logger, before any browser options are parsed. This typically means the log level or category filter derived from K6_BROWSER_LOG (or K6_BROWSER_LOG_CATEGORY_FILTER/SHOW_IMPORTANT) could not be interpreted. It aborts Launch/Connect/ConnectOverCDP during init.","triggerScenarios":"Thrown at internal/js/modules/k6/browser/chromium/browser_type.go:82 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Check K6_BROWSER_LOG for a valid level: trace, debug, info, warning, error","Verify K6_BROWSER_LOG_CATEGORY_FILTER syntax (comma-separated categories, optional - prefixes)","Unset suspicious browser log env vars and retry with defaults"],"exampleFix":null,"handlingStrategy":"validation","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"8d06114777191d21ef885d05c5f8aa9e1ed838ae","analyzedAt":"2026-08-18T03:05:52.393Z","contentChangedAt":"2026-08-18T03:05:52.393Z","schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}