{"record":{"id":"891a65012d4c50d0","repo":"grafana/k6","slug":"the-kafka-output-was-deprecated-in-k6-v0-32-0-and","errorCode":null,"errorMessage":"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","messagePattern":"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","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"internal/cmd/outputs.go","lineNumber":53,"sourceCode":"\tbuiltinOutputInfluxdb\n\tbuiltinOutputJSON\n\tbuiltinOutputKafka\n\tbuiltinOutputStatsd\n\tbuiltinOutputExperimentalOpentelemetry\n\tbuiltinOutputOpentelemetry\n\tbuiltinOutputSummary\n)\n\n// TODO: move this to an output sub-module after we get rid of the old collectors?\nfunc getAllOutputConstructors() (map[string]output.Constructor, error) {\n\t// Start with the built-in outputs\n\tresult := map[string]output.Constructor{\n\t\tbuiltinOutputJSON.String():     json.New,\n\t\tbuiltinOutputCloud.String():    cloud.New,\n\t\tbuiltinOutputCSV.String():      csv.New,\n\t\tbuiltinOutputInfluxdb.String(): influxdb.New,\n\t\tbuiltinOutputKafka.String(): func(_ output.Params) (output.Output, error) {\n\t\t\treturn nil, errors.New(\"the kafka output was deprecated in k6 v0.32.0 and removed in k6 v0.34.0, \" +\n\t\t\t\t\"please use the new xk6 kafka output extension instead - https://github.com/k6io/xk6-output-kafka\")\n\t\t},\n\t\tbuiltinOutputStatsd.String(): func(_ output.Params) (output.Output, error) {\n\t\t\treturn nil, errors.New(\"the statsd output was deprecated in k6 v0.47.0 and removed in k6 v0.55.0, \" +\n\t\t\t\t\"please use the new xk6 statsd output extension instead. \" +\n\t\t\t\t\"It can be found at https://github.com/LeonAdato/xk6-output-statsd and \" +\n\t\t\t\t\"more info at https://github.com/grafana/k6/issues/2982\")\n\t\t},\n\t\tbuiltinOutputDatadog.String(): func(_ output.Params) (output.Output, error) {\n\t\t\treturn nil, errors.New(\"the datadog output was deprecated in k6 v0.32.0 and removed in k6 v0.34.0, \" +\n\t\t\t\t\"please use the statsd output extension https://github.com/LeonAdato/xk6-output-statsd with environment \" +\n\t\t\t\t\"variable K6_STATSD_ENABLE_TAGS=true or an experimental opentelemetry output instead\",\n\t\t\t)\n\t\t},\n\t\tbuiltinOutputExperimentalPrometheusRW.String(): func(params output.Params) (output.Output, error) {\n\t\t\treturn remotewrite.New(params)\n\t\t},\n\t\t\"web-dashboard\": dashboard.New,","sourceCodeStart":35,"sourceCodeEnd":71,"githubUrl":"https://github.com/grafana/k6/blob/93accf6570dcd306ca5e99cc44c393ee3797761b/internal/cmd/outputs.go#L35-L71","documentation":"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'.","triggerScenarios":"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\"].","commonSituations":"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.","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"],"exampleFix":"# before\nk6 run --out kafka script.js   # ERR: kafka output removed in v0.34.0\n\n# after\nxk6 build --with github.com/k6io/xk6-output-kafka\n./k6 run --out kafka script.js   # extension-provided output\n# or: k6 run --out json script.js","handlingStrategy":"fallback","validationCode":"# detect removed outputs before running\nfor o in $(echo \"${K6_OUT:-}\" | tr ',' ' ') $(echo \"${OUTPUTS:-}\" | tr ',' ' '); do\n  case \"$o\" in kafka|statsd|datadog) echo \"output '$o' was removed; use the xk6 extension\" >&2; exit 1 ;; esac\ndone","typeGuard":null,"tryCatchPattern":"constructors, err := getAllOutputConstructors()\nif err != nil {\n    // registry-level failure (e.g. experimental output misconfig); the kafka\n    // stub error only fires at construction: intercept and suggest the extension\n    return err\n}\nif _, ok := constructors[builtinOutputKafka.String()]; ok {\n    kafkaCtor := constructors[builtinOutputKafka.String()]\n    if _, err := kafkaCtor(params); err != nil && strings.Contains(err.Error(), \"kafka output was deprecated\") {\n        return guideUserToExtension(err)\n    }\n}","preventionTips":["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"],"tags":["output","kafka","deprecated","removed","migration","cli"],"backgroundTag":null,"analyzedSha":"93accf6570dcd306ca5e99cc44c393ee3797761b","analyzedAt":"2026-08-15T21:23:27.118Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}