{"record":{"id":"421fae4ba1a77f14","repo":"grafana/k6","slug":"k6-couldn-t-detect-google-chrome-or-a-chromium-sup","errorCode":null,"errorMessage":"k6 couldn't detect google chrome or a chromium-supported browser on this system","messagePattern":"k6 couldn't detect google chrome or a chromium-supported browser on this system","errorType":"exception","errorClass":"ErrChromeNotInstalled","httpStatus":null,"severity":"error","filePath":"internal/js/modules/k6/browser/chromium/browser_type.go","lineNumber":345,"sourceCode":") (_ *common.BrowserProcess, rerr error) {\n\tbProcCtx, bProcCtxCancel := context.WithCancelCause(ctx)\n\tdefer func() {\n\t\tif rerr != nil {\n\t\t\tbProcCtxCancel(errors.New(\"local browser process init failed\"))\n\t\t}\n\t}()\n\n\targs, err := parseArgs(flags)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\treturn common.NewLocalBrowserProcess(bProcCtx, path, args, dataDir, bProcCtxCancel, logger) //nolint: wrapcheck\n}\n\nvar (\n\t// ErrChromeNotInstalled is returned when the Chrome executable is not found.\n\tErrChromeNotInstalled = errors.New(\n\t\t\"k6 couldn't detect google chrome or a chromium-supported browser on this system\",\n\t)\n\n\t// ErrChromeNotFoundAtPath is returned when the Chrome executable is not found at the given path.\n\tErrChromeNotFoundAtPath = errors.New(\n\t\t\"k6 couldn't detect google chrome or a chromium-supported browser on the given path\",\n\t)\n)\n\n// executablePath returns the path where the extension expects to find the browser executable.\nfunc executablePath(\n\tpath string,\n\tenv env.LookupFunc,\n\tlookPath func(file string) (string, error), // os.LookPath\n) (string, error) {\n\t// find the browser executable in the user provided path\n\tif path := strings.TrimSpace(path); path != \"\" {\n\t\tif _, err := lookPath(path); err == nil {","sourceCodeStart":327,"sourceCodeEnd":363,"githubUrl":"https://github.com/grafana/k6/blob/8d06114777191d21ef885d05c5f8aa9e1ed838ae/internal/js/modules/k6/browser/chromium/browser_type.go#L327-L363","documentation":"When k6 launches a local browser it looks for a Google Chrome or Chromium executable in standard locations (honoring K6_BROWSER_PATH); if none is found, ErrChromeNotInstalled (chromium/browser_type.go:345) aborts browser startup before any test code runs. This is an environment problem, not a script problem.","triggerScenarios":"Running browser tests on a host or container with no Chrome/Chromium installed: minimal Docker images (alpine/distroless/slim), bare CI runners without a browser step, freshly provisioned VMs, or a K6_BROWSER_PATH that is unset while no system-wide install exists.","commonSituations":"CI pipelines moving to slimmer images; running k6 on servers/containers without a GUI browser; new teammates on Linux distros where Chrome isn't preinstalled; using the plain grafana/k6 image and expecting a bundled browser.","solutions":["Install Google Chrome or Chromium on the host (apt-get install -y chromium, or the official Chrome package)","Point k6 at an existing binary: K6_BROWSER_PATH=/usr/bin/chromium k6 run script.js (or the execPath browser option on recent versions)","Use a remote browser instead: run a Chromium container and set K6_BROWSER_WS_URL to its webSocketDebuggerUrl","Use a k6 image with a browser preinstalled (e.g. grafana/k6 with a Chromium layer, or mcr.microsoft.com/playwright/python with k6 added)"],"exampleFix":"# before\nk6 run script.js  # -> k6 couldn't detect google chrome or a chromium-supported browser on this system\n\n# after\napt-get update && apt-get install -y chromium\nK6_BROWSER_PATH=/usr/bin/chromium k6 run script.js","handlingStrategy":"validation","validationCode":"# fail fast before the test run\ncommand -v google-chrome >/dev/null 2>&1 \\\n  || command -v google-chrome-stable >/dev/null 2>&1 \\\n  || command -v chromium >/dev/null 2>&1 \\\n  || command -v chromium-browser >/dev/null 2>&1 \\\n  || { echo 'no chrome/chromium found — install one or set K6_BROWSER_PATH / K6_BROWSER_WS_URL' >&2; exit 1; }\nk6 run script.js","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Bake Chrome/Chromium into the CI image rather than installing it per job","Standardize K6_BROWSER_PATH across environments so the lookup is deterministic","For remote browser grids, pin K6_BROWSER_WS_URL and skip local installs entirely","Document the browser requirement in the repo README so new environments fail with context"],"tags":["browser","environment","chrome","chromium","setup","ci"],"backgroundTag":"browser-executable-not-found","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"}