grafana/k6 · error

file does not exist

Error message

file does not exist: %s

What it means

exec.Cmd.Start reported os.IsNotExist while spawning the browser binary: the resolved executable path doesn't exist at start time (e.g. deleted between lookup and launch, or a broken container image). The path is echoed in the message.

Solutions

  1. Verify the browser binary exists in the container/image at that path
  2. Re-install or re-mount Chrome/Chromium
  3. Point K6_BROWSER_EXECUTABLE_PATH to an existing binary
Defensive patterns

Strategy: fallback

When it happens

Trigger: Thrown at internal/js/modules/k6/browser/common/browser_process.go:177 when the library encounters an invalid state.

Common situations: See trigger scenarios.


AI-assisted analysis of grafana/k6@01ffac6f24 (2026-08-18). Data as JSON: /api/errors/00933b6cf6e79ae2. Report an issue: GitHub.

Appendix: source

Thrown at internal/js/modules/k6/browser/common/browser_process.go:177

	dataDir *storage.Dir, logger *log.Logger,
) (command, error) {
	cmd := exec.CommandContext(ctx, path, args...) //nolint:gosec
	killAfterParent(cmd)

	stdout, err := cmd.StdoutPipe()
	if err != nil {
		return command{}, fmt.Errorf("%w", err)
	}
	stderr, err := cmd.StderrPipe()
	if err != nil {
		return command{}, fmt.Errorf("%w", err)
	}

	// We must start the cmd before calling cmd.Wait, as otherwise the two
	// can run into a data race.
	err = cmd.Start()
	if os.IsNotExist(err) { //nolint:forbidigo
		return command{}, fmt.Errorf("file does not exist: %s", path)
	}
	if err != nil {
		return command{}, fmt.Errorf("%w", err)
	}
	if ctx.Err() != nil {
		return command{}, ContextErr(ctx)
	}

	done := make(chan struct{})
	go func() {
		// TODO: How to handle these errors?
		defer func() {
			if err := dataDir.Cleanup(); err != nil {
				logger.Errorf("browser", "cleaning up the user data directory: %v", err)
			}
			close(done)
		}()

View on GitHub (pinned to 01ffac6f24)