{"record":{"id":"f16b59a45efced3c","repo":"grafana/k6","slug":"invalid-protocol","errorCode":null,"errorMessage":"invalid protocol","messagePattern":"invalid protocol","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"internal/lib/trace/otel.go","lineNumber":29,"sourceCode":"\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}\n\ntype tracerProviderParams struct {","sourceCodeStart":11,"sourceCodeEnd":47,"githubUrl":"https://github.com/grafana/k6/blob/01ffac6f245854c1b8adc6a69857c76a15f90022/internal/lib/trace/otel.go#L11-L47","documentation":"Within the --traces-output=otel=... configuration line, the proto= option selects the exporter transport and accepts exactly 'http' or 'grpc' (default 'grpc'). params.parseProto returns ErrInvalidProto wrapped as \"couldn't parse the otel proto\" for any other value. Note this is k6's own parameter name — OTel SDK spellings like 'http/protobuf' are not accepted here.","triggerScenarios":"Passing --traces-output='otel=...,proto=http/protobuf' (OTel SDK convention instead of k6's 'http'); proto=grpc-web, proto=h2, or any typo such as proto=GRPC (case-sensitive).","commonSituations":"Copying values from OTEL_EXPORTER_OTLP_PROTOCOL docs or collector configs into k6's traces flag; assuming protocol names are case-insensitive.","solutions":["Use proto=http or proto=grpc exactly (lowercase)","Omit proto= entirely to get the default grpc transport","If you only need an HTTP endpoint, pass the URL form: otel=http://host:4318/v1/traces (this implies proto=http)"],"exampleFix":"# before\nk6 run --traces-output='otel=127.0.0.1:4318/v1/traces,proto=http/protobuf' script.js\n# after\nk6 run --traces-output='otel=http://127.0.0.1:4318/v1/traces,proto=http' script.js","handlingStrategy":"validation","validationCode":"// Shell\nproto=\"$(echo \"$TRACES_OUTPUT\" | tr ',' '\\n' | grep '^proto=' | cut -d= -f2)\"\nif [ -n \"$proto\" ] && [ \"$proto\" != \"http\" ] && [ \"$proto\" != \"grpc\" ]; then\n  echo \"proto= must be http or grpc\" >&2; exit 1\nfi","typeGuard":"function isValidTraceProto(p) {\n  return p === '' || p === 'http' || p === 'grpc';\n}","tryCatchPattern":null,"preventionTips":["Use only lowercase http or grpc for the proto option in --traces-output","Do not paste OTEL_EXPORTER_OTLP_PROTOCOL values (http/protobuf, http/json) into this k6 flag","Omit proto= when unsure — the grpc default is usually right for a local collector"],"tags":["tracing","opentelemetry","protocol","configuration","k6"],"backgroundTag":"unsupported-protocol","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"}