grafana/k6 · error

the kafka output was deprecated in k6 v0.32.0 and removed…

Error message

the kafka output was deprecated in k6 v0.32.0 and removed in k6 v0.34.0, please use the new xk6 kafka output extension instead - https://github.com/k6io/xk6-output-kafka

What it means

k6 removed its built-in Kafka output. In getAllOutputConstructors (internal/cmd/outputs.go:53) the 'kafka' entry is a constructor stub that unconditionally returns this error, so any attempt to enable the output fails at setup time. The message points to the replacement: the xk6-output-kafka extension, deprecated since k6 v0.32.0 and removed in v0.34.0.

Solutions

  1. Remove `--out kafka` / `K6_OUT=kafka` from the command line, environment, or config files.
  2. Build k6 with the extension: `xk6 build --with github.com/k6io/xk6-output-kafka`, then run `./k6 run --out kafka script.js` using that binary.
  3. Alternatively use a still-supported output (`--out json`, `--out csv`, `--out experimental-prometheus-rw`) and ship metrics to Kafka from there.

Example fix

# before
k6 run --out kafka=brokers=kafka:9092,topic=k6 script.js
# after
xk6 build --with github.com/k6io/xk6-output-kafka
./k6 run --out kafka script.js
Defensive patterns

Strategy: validation

Validate before calling

# fail fast before upgrading k6: find removed output usages
if grep -rnE -- '--out kafka|K6_OUT=kafka|K6_KAFKA_' ci/ scripts/ Makefile 2>/dev/null; then
  echo 'kafka output removed in k6 v0.34.0 - migrate to xk6-output-kafka first'
  exit 1
fi

Prevention

When it happens

Trigger: Running k6 with `--out kafka` (with or without `kafka=...` config) or `K6_OUT=kafka` on any k6 binary >= v0.34.0; also `k6 archive`/`k6 cloud` invocations that request the kafka output via CLI flags or env.

Common situations: CI pipelines, Makefiles, or wrapper scripts written for k6 <= v0.33.x still passing `--out kafka=brokers=...`; docs or blog examples copied from old versions; upgrading k6 without migrating output configuration.

Related errors


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

Appendix: source

Thrown at internal/cmd/outputs.go:53

	builtinOutputInfluxdb
	builtinOutputJSON
	builtinOutputKafka
	builtinOutputStatsd
	builtinOutputExperimentalOpentelemetry
	builtinOutputOpentelemetry
	builtinOutputSummary
)

// TODO: move this to an output sub-module after we get rid of the old collectors?
func getAllOutputConstructors() (map[string]output.Constructor, error) {
	// Start with the built-in outputs
	result := map[string]output.Constructor{
		builtinOutputJSON.String():     json.New,
		builtinOutputCloud.String():    cloud.New,
		builtinOutputCSV.String():      csv.New,
		builtinOutputInfluxdb.String(): influxdb.New,
		builtinOutputKafka.String(): func(_ output.Params) (output.Output, error) {
			return nil, errors.New("the kafka output was deprecated in k6 v0.32.0 and removed in k6 v0.34.0, " +
				"please use the new xk6 kafka output extension instead - https://github.com/k6io/xk6-output-kafka")
		},
		builtinOutputStatsd.String(): func(_ output.Params) (output.Output, error) {
			return nil, errors.New("the statsd output was deprecated in k6 v0.47.0 and removed in k6 v0.55.0, " +
				"please use the new xk6 statsd output extension instead. " +
				"It can be found at https://github.com/LeonAdato/xk6-output-statsd and " +
				"more info at https://github.com/grafana/k6/issues/2982")
		},
		builtinOutputDatadog.String(): func(_ output.Params) (output.Output, error) {
			return nil, errors.New("the datadog output was deprecated in k6 v0.32.0 and removed in k6 v0.34.0, " +
				"please use the statsd output extension https://github.com/LeonAdato/xk6-output-statsd with environment " +
				"variable K6_STATSD_ENABLE_TAGS=true or an experimental opentelemetry output instead",
			)
		},
		builtinOutputExperimentalPrometheusRW.String(): func(params output.Params) (output.Output, error) {
			return remotewrite.New(params)
		},
		"web-dashboard": dashboard.New,

View on GitHub (pinned to 01ffac6f24)