grafana/k6 · error

k6/experimental/tracing has been removed. All of it…

Error message

k6/experimental/tracing has been removed. All of it functionality is available as pure JavaScript module. More info available at the docs: https://grafana.com/docs/k6/latest/javascript-api/jslib/http-instrumentation-tempo

What it means

k6 no longer ships the k6/experimental/tracing module. The registry maps that import path to a stub module (newRemovedModule in internal/js/jsmodules.go:98-110) whose NewModuleInstance always throws via common.Throw, so any script that imports it fails during script initialization. The tracing instrumentation was moved out of the k6 binary into a pure-JavaScript jslib module (http-instrumentation-tempo).

Solutions

  1. Replace the import with the jslib module: `import { HTTPInstrumentation } from 'https://jslib.k6.io/http-instrumentation-tempo/1.0.1/index.js'` and instantiate `new HTTPInstrumentation(...)` instead of `tracing.instrumentHTTP(...)` (see https://grafana.com/docs/k6/latest/javascript-api/jslib/http-instrumentation-tempo)
  2. If you do not use tracing, simply delete the import line
  3. Pin your CI/CD to a k6 version that still bundles the module only as a temporary stopgap while you migrate

Example fix

// before
import tracing from 'k6/experimental/tracing';
tracing.instrumentHTTP({ propagator: 'w3c' });

// after
import { HTTPInstrumentation } from 'https://jslib.k6.com/http-instrumentation-tempo/1.0.1/index.js';
// https://jslib.k6.io/http-instrumentation-tempo/1.0.1/index.js
const instrumentor = new HTTPInstrumentation({ propagator: 'w3c' });
Defensive patterns

Strategy: validation

Validate before calling

# CI pre-flight: fail before k6 runs if a script imports a removed module
if grep -rnE "k6/experimental/(tracing|webcrypto|browser|grpc|timers|redis)" scripts/; then
  echo "ERROR: script imports a k6 module that was removed; migrate it first" >&2
  exit 1
fi

Prevention

When it happens

Trigger: A script contains `import tracing from 'k6/experimental/tracing'` (or `import { instrumentHTTP } from 'k6/experimental/tracing'`) and runs on a k6 version where the module was removed. The error is thrown the moment the module is instantiated, before any code in the script body executes.

Common situations: Upgrading k6 (v0.5x to v1.x) while reusing old scripts or shared libraries that instrument HTTP with distributed-tracing headers for Grafana Tempo; CI jobs that pin old scripts against a newer k6 docker image; copying an example script from an outdated tutorial or forum post.

Related errors


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

Appendix: 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 01ffac6f24)