{"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/93accf6570dcd306ca5e99cc44c393ee3797761b/internal/js/modules/k6/browser/chromium/browser_type.go#L327-L363","documentation":"When neither an explicit executable path nor a WS endpoint is configured, k6 searches the OS's default locations for a Chrome/Chromium binary. ErrChromeNotInstalled means that search found nothing usable, so k6 has no local browser to launch for the browser scenario.","triggerScenarios":"Running a browser scenario on a fresh CI container (alpine, slim Debian) with no Chrome installed; a macOS/Linux box where Chrome was never installed or was uninstalled; a stripped image where chromium exists only under a non-standard name k6 does not probe.","commonSituations":"GitHub Actions/Docker images without a chrome setup step; company base images that deliberately exclude browsers; OS upgrades removing the chrome package; running on a server (no desktop) where Chrome was assumed present.","solutions":["Install Google Chrome or Chromium on the host (e.g. apt-get install -y chromium chromium-driver on Debian/Ubuntu; apk add chromium on Alpine)","Point k6 at an existing binary: K6_BROWSER_EXECUTABLE_PATH=/usr/bin/chromium or the executablePath browser option","Or bypass local launch entirely with K6_BROWSER_WS_ENDPOINT pointing at an already-running Chrome","Verify detection first: which google-chrome google-chrome-stable chromium chromium-browser — if all fail, so will k6"],"exampleFix":"# before (Dockerfile with no browser)\nFROM alpine\nRUN k6 run script.js\n\n# after\nFROM alpine\nRUN apk add --no-cache chromium chromium-swiftshader\nENV K6_BROWSER_EXECUTABLE_PATH=/usr/bin/chromium-browser\n","handlingStrategy":"fallback","validationCode":"#!/bin/sh\n# preflight: fail early with a clear message instead of mid-run\nfor b in google-chrome google-chrome-stable chromium chromium-browser; do\n  command -v \"$b\" >/dev/null 2>&1 && exit 0\ndone\necho 'no chrome/chromium found; install one or set K6_BROWSER_EXECUTABLE_PATH / K6_BROWSER_WS_ENDPOINT' >&2\nexit 1","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Install chromium in the CI image explicitly and pin K6_BROWSER_EXECUTABLE_PATH to it","Prefer a service container exposing CDP (K6_BROWSER_WS_ENDPOINT) so runner images need no browser","Add a smoke step: run the binary with --version in CI before the k6 job"],"tags":["browser","chrome","environment","installation","docker","ci"],"backgroundTag":null,"analyzedSha":"93accf6570dcd306ca5e99cc44c393ee3797761b","analyzedAt":"2026-08-15T21:23:27.118Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}