grafana/k6 · error

k6/experimental/timers has been graduated, and it's now glob

Error message

k6/experimental/timers has been graduated, and it's now globally available as defined by standard WebAPIs. You just need to remove the import.

What it means

k6/experimental/timers graduated: setTimeout, setInterval, clearTimeout and clearInterval are now globally available per the standard WebAPIs, so the module was removed entirely. Importing it hits the removedModule stub which throws this message.

Source

Thrown at internal/js/jsmodules.go:107

	// external is always prefixed with `k6/x`
	for _, e := range external {
		result[e.Name] = e.Module
	}

	return result
}

type removedModule struct {
	errMsg string
}

func newRemovedModule(errMsg string) modules.Module {
	return &removedModule{errMsg: errMsg}
}

func (rm *removedModule) NewModuleInstance(vu modules.VU) modules.Instance {
	common.Throw(vu.Runtime(), errors.New(rm.errMsg))

	return nil
}

type warnExperimentalModule struct {
	once sync.Once
	msg  string
	base modules.Module
}

func newWarnExperimentalModule(base modules.Module, msg string) modules.Module {
	return &warnExperimentalModule{
		msg:  msg,
		base: base,
	}
}

func (w *warnExperimentalModule) NewModuleInstance(vu modules.VU) modules.Instance {

View on GitHub (pinned to 93accf6570)

Solutions

  1. Delete the import — the timer functions are global
  2. Keep the calls as-is (setTimeout(...) works unchanged), or use k6/timers if you prefer explicit imports

Example fix

// before
import { setTimeout } from 'k6/experimental/timers';
setTimeout(() => {}, 100);

// after
setTimeout(() => {}, 100);
Defensive patterns

Strategy: validation

Validate before calling

grep -rn "k6/experimental/timers" . --include='*.js' && { echo 'timers are global now — delete the import' >&2; exit 1; } || true

Prevention

When it happens

Trigger: `import { setTimeout } from 'k6/experimental/timers'` (or any named import from that path) on a current k6 build.

Common situations: Older scripts that needed the polyfill; code copied from pre-graduation examples that still imports the module.

Related errors


AI-assisted analysis of grafana/k6@93accf6570 (2026-08-15). Data as JSON: /api/errors/0cf7294a5e4929c1. Report an issue: GitHub.