{"record":{"id":"3a3a7622b94de7c4","repo":"grafana/k6","slug":"unsupported-browser-type-s","errorCode":null,"errorMessage":"unsupported browser type: %s","messagePattern":"unsupported browser type: (.+?)","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"internal/js/modules/k6/browser/common/browser_options.go","lineNumber":70,"sourceCode":"\t\tTimeout:           DefaultTimeout,\n\t\tisRemoteBrowser:   true,\n\t}\n}\n\n// Parse parses browser options from a JS object.\nfunc (bo *BrowserOptions) Parse(\n\tctx context.Context, logger *log.Logger, opts map[string]any, envLookup env.LookupFunc,\n) error {\n\t// Parse opts\n\tbt, ok := opts[optType]\n\t// Only 'chromium' is supported by now, so return error\n\t// if type option is not set, or if it's set and its value\n\t// is different than 'chromium'\n\tif !ok {\n\t\treturn errors.New(\"browser type option must be set\")\n\t}\n\tif bt != \"chromium\" {\n\t\treturn fmt.Errorf(\"unsupported browser type: %s\", bt)\n\t}\n\n\t// Parse env\n\tenvOpts := [...]string{\n\t\tenv.BrowserArguments,\n\t\tenv.BrowserEnableDebugging,\n\t\tenv.BrowserExecutablePath,\n\t\tenv.BrowserHeadless,\n\t\tenv.BrowserIgnoreDefaultArgs,\n\t\tenv.LogCategoryFilter,\n\t\tenv.BrowserGlobalTimeout,\n\t}\n\n\tfor _, e := range envOpts {\n\t\tev, ok := envLookup(e)\n\t\tif !ok || ev == \"\" {\n\t\t\tcontinue\n\t\t}","sourceCodeStart":52,"sourceCodeEnd":88,"githubUrl":"https://github.com/grafana/k6/blob/93accf6570dcd306ca5e99cc44c393ee3797761b/internal/js/modules/k6/browser/common/browser_options.go#L52-L88","documentation":"BrowserOptions.Parse rejects any browser type other than the literal string \"chromium\". k6's browser module is CDP/Chromium-only, so the launcher validates the type option up front and aborts before any process is started. The %s in the message echoes back the offending value.","triggerScenarios":"Setting the browser type option in the launcher options map (e.g. NewLauncher(ctx, logger, opts) with opts[\"type\"] = \"firefox\" or \"webkit\"), or configuring options.browser.type in a k6 script to anything except \"chromium\".","commonSituations":"Porting Playwright test scripts that specify firefox/webkit channels; assuming k6 supports the Playwright browser matrix; typos like \"Chromium\" (capital C) or \"chrome\". Note the type option is mandatory: omitting it produces the sibling error \"browser type option must be set\".","solutions":["Set the browser type option to exactly \"chromium\" (lowercase) in the launcher options / script options.","If you need Firefox or WebKit, use Playwright directly; k6 only automates Chromium over CDP.","Check for typos or capitalized variants such as \"Chromium\" or \"chrome\"; only the exact string \"chromium\" passes."],"exampleFix":"// before\nconst launcher = launch('firefox');\n\n// after\nconst launcher = launch('chromium');","handlingStrategy":"validation","validationCode":"// k6 script: fail fast on unsupported browser type before the test runs\nconst BROWSER_TYPE = 'chromium';\nif (BROWSER_TYPE !== 'chromium') {\n  throw new Error(`k6 browser module only supports 'chromium', got '${BROWSER_TYPE}'`);\n}\nexport const options = { browser: { type: BROWSER_TYPE } };","typeGuard":"function isSupportedBrowserType(v) {\n  return typeof v === 'string' && v === 'chromium';\n}","tryCatchPattern":"try {\n  await launch('chromium');\n} catch (e) {\n  if (/unsupported browser type/.test(String(e))) {\n    console.error('Only chromium is supported; fix options.browser.type');\n  }\n  throw e;\n}","preventionTips":["Standardize options.browser.type: 'chromium' in shared script templates.","When porting Playwright scripts, strip firefox/webkit channel settings.","Add a lint/review check that rejects any browser type literal other than chromium."],"tags":["browser","configuration","options","chromium"],"backgroundTag":null,"analyzedSha":"93accf6570dcd306ca5e99cc44c393ee3797761b","analyzedAt":"2026-08-15T21:23:27.118Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}