{"record":{"id":"6de9121088da750a","repo":"grafana/k6","slug":"invalid-traces-output","errorCode":null,"errorMessage":"invalid traces output","messagePattern":"invalid traces output","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"internal/lib/trace/otel.go","lineNumber":27,"sourceCode":"\n\t\"go.opentelemetry.io/otel\"\n\t\"go.opentelemetry.io/otel/exporters/otlp/otlptrace\"\n\t\"go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc\"\n\t\"go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracehttp\"\n\t\"go.opentelemetry.io/otel/sdk/resource\"\n\tsdktrace \"go.opentelemetry.io/otel/sdk/trace\"\n\tsemconv \"go.opentelemetry.io/otel/semconv/v1.20.0\"\n\t\"go.opentelemetry.io/otel/trace\"\n\t\"go.opentelemetry.io/otel/trace/noop\"\n\n\t\"go.k6.io/k6/v2/internal/lib/strvals\"\n)\n\nconst serviceName = \"k6\"\n\nvar (\n\t// ErrInvalidTracesOutput indicates that the defined traces output is not valid.\n\tErrInvalidTracesOutput = errors.New(\"invalid traces output\")\n\t// ErrInvalidProto indicates that the defined exporter protocol is not valid.\n\tErrInvalidProto = errors.New(\"invalid protocol\")\n\t// ErrInvalidURLScheme indicates that the defined exporter URL scheme is not valid.\n\tErrInvalidURLScheme = errors.New(\"invalid URL scheme\")\n\t// ErrInvalidGRPCWithURLPath indicates that an exporter using gRPC protocol does not support URL path.\n\tErrInvalidGRPCWithURLPath = errors.New(\"grpc protocol does not support URL path\")\n)\n\ntype (\n\ttracerProvShutdownFunc func(ctx context.Context) error\n)\n\n// TracerProvider provides methods for tracers initialization and shutdown of the\n// processing pipeline.\ntype TracerProvider struct {\n\ttrace.TracerProvider\n\tshutdown tracerProvShutdownFunc\n}","sourceCodeStart":9,"sourceCodeEnd":45,"githubUrl":"https://github.com/grafana/k6/blob/01ffac6f245854c1b8adc6a69857c76a15f90022/internal/lib/trace/otel.go#L9-L45","documentation":"k6's --traces-output flag currently accepts only the OpenTelemetry output, identified by the literal token 'otel' (optionally with parameters: otel=<url>,proto=<grpc|http>,header.<Name>=<value>). tracerProviderParamsFromConfigLine splits the value at '=' and returns ErrInvalidTracesOutput when the part before '=' is not 'otel', i.e. the output type itself is unrecognized.","triggerScenarios":"Running k6 run --traces-output=otlp or --traces-output=zipkin or any value whose prefix is not 'otel'; also a bare unrecognized word like --traces-output=jaeger.","commonSituations":"Assuming k6 supports the same trace output names as the OTel collector or other tools ('otlp', 'console'); copy-pasting collector config into the k6 flag; missing that the value must literally be 'otel'.","solutions":["Use --traces-output=otel for defaults (grpc to 127.0.0.1:4317, insecure)","Use the parameterized form, e.g. --traces-output='otel=http://127.0.0.1:4318/v1/traces,proto=http,header.Authorization=token'","Check for typos in the value before '=' — only 'otel' is recognized"],"exampleFix":"# before\nk6 run --traces-output=otlp script.js\n# after\nk6 run --traces-output=otel script.js","handlingStrategy":"validation","validationCode":"// Shell / wrapper: check the flag before invoking k6\nline=\"$TRACES_OUTPUT\"\nif [ \"$line\" != \"otel\" ] && [ \"${line%%=*}\" != \"otel\" ]; then\n  echo \"--traces-output must start with 'otel'\" >&2; exit 1\nfi\nk6 run --traces-output=\"$line\" script.js","typeGuard":"function isOtelTracesLine(s) {\n  return s === 'otel' || s.startsWith('otel=');\n}","tryCatchPattern":null,"preventionTips":["Remember the only supported traces output is the literal token 'otel' with optional '=' parameters","Keep traces configuration in one shared snippet instead of re-typing the flag per job","Document next to the flag that collector-style output names (otlp, zipkin) are not valid here"],"tags":["tracing","opentelemetry","configuration","cli","k6"],"backgroundTag":"invalid-config-value","analyzedSha":"01ffac6f245854c1b8adc6a69857c76a15f90022","analyzedAt":"2026-08-18T03:05:52.393Z","contentChangedAt":"2026-08-18T03:05:52.393Z","schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}