grafana/k6 · error
the kafka output was deprecated in k6 v0.32.0 and removed in
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
Returned by the output constructor registry when 'kafka' is requested as an output: the built-in kafka output was deprecated in k6 v0.32.0 and its code was removed in v0.34.0. The constructor deliberately returns this error (instead of the flag being unknown) so users of old configs get an explanation and a migration pointer rather than a generic 'unknown output'.
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 93accf6570)
Solutions
- Build a k6 binary with the extension: xk6 build --with github.com/k6io/xk6-output-kafka, then use its documented K6_KAFKA_* env vars
- Or switch to a still-built-in output (json, csv) while you migrate
- Remove 'kafka' from K6_OUT / --out / script options so the run can start
Example fix
# before k6 run --out kafka script.js # ERR: kafka output removed in v0.34.0 # after xk6 build --with github.com/k6io/xk6-output-kafka ./k6 run --out kafka script.js # extension-provided output # or: k6 run --out json script.js
Defensive patterns
Strategy: fallback
Validate before calling
# detect removed outputs before running
for o in $(echo "${K6_OUT:-}" | tr ',' ' ') $(echo "${OUTPUTS:-}" | tr ',' ' '); do
case "$o" in kafka|statsd|datadog) echo "output '$o' was removed; use the xk6 extension" >&2; exit 1 ;; esac
done Try / catch
constructors, err := getAllOutputConstructors()
if err != nil {
// registry-level failure (e.g. experimental output misconfig); the kafka
// stub error only fires at construction: intercept and suggest the extension
return err
}
if _, ok := constructors[builtinOutputKafka.String()]; ok {
kafkaCtor := constructors[builtinOutputKafka.String()]
if _, err := kafkaCtor(params); err != nil && strings.Contains(err.Error(), "kafka output was deprecated") {
return guideUserToExtension(err)
}
} Prevention
- Sweep configs for 'kafka' in --out/K6_OUT/archived options before upgrading k6 past v0.34
- Produce your k6 binary with xk6 build --with github.com/k6io/xk6-output-kafka when kafka output is required
- Prefer json/csv for quick local runs to avoid extension builds entirely
When it happens
Trigger: Running any command with --out kafka or K6_OUT=kafka (including comma-separated lists like K6_OUT=json,kafka) on any modern k6; archived scripts whose options still list output: ["kafka"].
Common situations: Upgrading from k6 < v0.34 with old configs/docs; CI pipelines still exporting K6_OUT=kafka; tutorials or docker images predating the removal. The fix is always to move to the xk6 extension or a different output.
Related errors
- the statsd output was deprecated in k6 v0.47.0 and removed i
- the datadog output was deprecated in k6 v0.32.0 and removed
- Run `k6 cloud login` to authenticate, or check the docs for
- access token not configured
- no project specified. Use --project-id, set K6_CLOUD_PROJECT
AI-assisted analysis of grafana/k6@93accf6570 (2026-08-15).
Data as JSON: /api/errors/891a65012d4c50d0.
Report an issue: GitHub.