grafana/k6 · error
unsupported browser type: %s
Error message
unsupported browser type: %s
What it means
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.
Source
Thrown at internal/js/modules/k6/browser/common/browser_options.go:70
Timeout: DefaultTimeout,
isRemoteBrowser: true,
}
}
// Parse parses browser options from a JS object.
func (bo *BrowserOptions) Parse(
ctx context.Context, logger *log.Logger, opts map[string]any, envLookup env.LookupFunc,
) error {
// Parse opts
bt, ok := opts[optType]
// Only 'chromium' is supported by now, so return error
// if type option is not set, or if it's set and its value
// is different than 'chromium'
if !ok {
return errors.New("browser type option must be set")
}
if bt != "chromium" {
return fmt.Errorf("unsupported browser type: %s", bt)
}
// Parse env
envOpts := [...]string{
env.BrowserArguments,
env.BrowserEnableDebugging,
env.BrowserExecutablePath,
env.BrowserHeadless,
env.BrowserIgnoreDefaultArgs,
env.LogCategoryFilter,
env.BrowserGlobalTimeout,
}
for _, e := range envOpts {
ev, ok := envLookup(e)
if !ok || ev == "" {
continue
}View on GitHub (pinned to 93accf6570)
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.
Example fix
// before
const launcher = launch('firefox');
// after
const launcher = launch('chromium'); Defensive patterns
Strategy: validation
Validate before calling
// k6 script: fail fast on unsupported browser type before the test runs
const BROWSER_TYPE = 'chromium';
if (BROWSER_TYPE !== 'chromium') {
throw new Error(`k6 browser module only supports 'chromium', got '${BROWSER_TYPE}'`);
}
export const options = { browser: { type: BROWSER_TYPE } }; Type guard
function isSupportedBrowserType(v) {
return typeof v === 'string' && v === 'chromium';
} Try / catch
try {
await launch('chromium');
} catch (e) {
if (/unsupported browser type/.test(String(e))) {
console.error('Only chromium is supported; fix options.browser.type');
}
throw e;
} Prevention
- 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.
When it happens
Trigger: 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".
Common situations: 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".
Related errors
- missing required url
- browser not found in registry. make sure to set browser type
- WebSocket endpoint cannot be empty
- k6 couldn't detect google chrome or a chromium-supported bro
- browser type option must be set
AI-assisted analysis of grafana/k6@93accf6570 (2026-08-15).
Data as JSON: /api/errors/3a3a7622b94de7c4.
Report an issue: GitHub.