grafana/k6 · error

making browser data directory %q: %w

Error message

making browser data directory %q: %w

What it means

Raised in storage.Make when os.MkdirTemp fails to create a temporary browser data directory using the K6BrowserDataDirPattern under tmpDir (the '%q' is the attempted path, extracted from the resulting *fs.PathError). It fires when no temporary directory can be created for the browser profile: TMPDIR unwritable/nonexistent, permission denied, or out of space/inodes. Browser launch then aborts.

Source

Thrown at internal/js/modules/k6/browser/storage/storage.go:59

		return nil
	}

	// create a temporary dir because the provided dir is empty.
	if d.fsMkdirTemp == nil {
		d.fsMkdirTemp = os.MkdirTemp //nolint:forbidigo
	}
	var err error
	if d.Dir, err = d.fsMkdirTemp(tmpDir, K6BrowserDataDirPattern); err != nil {
		var (
			pe   *fs.PathError
			path = filepath.Join(tmpDir, K6BrowserDataDirPattern)
		)
		if errors.As(err, &pe) {
			path = pe.Path
			err = pe.Err
		}

		return fmt.Errorf("making browser data directory %q: %w", path, err)
	}
	d.remove = true

	return nil
}

// Cleanup removes the temporary directory if Make was called with a non
// empty dir argument.
// It is named as Cleanup because it can be used for other features in the
// future.
func (d *Dir) Cleanup() error {
	d.mu.Lock()
	defer d.mu.Unlock()

	if !d.remove {
		return nil
	}

View on GitHub (pinned to 01ffac6f24)

Solutions

  1. Check TMPDIR (or pass an explicit writable dir) and its permissions
  2. Free disk space/inodes on the temp filesystem
  3. Verify the process user can create directories under the temp path
  4. Avoid running with a read-only or size-limited tmpfs for browser profiles
Defensive patterns

Strategy: try-catch

When it happens

Trigger: Thrown at internal/js/modules/k6/browser/storage/storage.go:59 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/9d9b3eac76989e0a. Report an issue: GitHub.