{"record":{"id":"e434671ad8bd02cb","repo":"grafana/k6","slug":"grpc-protocol-does-not-support-url-path","errorCode":null,"errorMessage":"grpc protocol does not support URL path","messagePattern":"grpc protocol does not support URL path","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"internal/lib/trace/otel.go","lineNumber":33,"sourceCode":"\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 {\n\tproto    string\n\tendpoint string\n\turlPath  string\n\tinsecure bool","sourceCodeStart":15,"sourceCodeEnd":51,"githubUrl":"https://github.com/grafana/k6/blob/01ffac6f245854c1b8adc6a69857c76a15f90022/internal/lib/trace/otel.go#L15-L51","documentation":"The gRPC trace exporter is addressed by host:port only and cannot use an HTTP URL path. After parsing the otel config line, k6 rejects the combination proto=grpc with a non-empty urlPath with ErrInvalidGRPCWithURLPath. A URL like otel=https://host:4318/v1/traces sets proto=http and a urlPath; explicitly adding proto=grpc afterwards overrides the protocol but leaves the path set, which fails this check.","triggerScenarios":"--traces-output='otel=https://collector:4318/v1/traces,proto=grpc' (URL with a path plus an explicit grpc protocol); any combination where the final params have proto=grpc and a URL path from a parsed http(s) URL.","commonSituations":"Copy-pasting an OTLP/HTTP collector endpoint (which always has /v1/traces) and forcing proto=grpc out of habit; mixing the URL form and the proto= option.","solutions":["Keep proto=http (or drop proto=) when the endpoint URL contains a path","For grpc, specify only host:port with no path — e.g. omit the URL and use otel=collector:4317,proto=grpc or plain --traces-output=otel","Point the gRPC exporter at the collector's 4317 port instead of the HTTP 4318 port"],"exampleFix":"# before\nk6 run --traces-output='otel=https://collector:4318/v1/traces,proto=grpc' script.js\n# after\nk6 run --traces-output='otel=http://collector:4318/v1/traces,proto=http' script.js","handlingStrategy":"validation","validationCode":"// Wrapper: reject proto=grpc when the URL contains a path\nif echo \"$TRACES_OUTPUT\" | grep -q 'proto=grpc' && echo \"$TRACES_OUTPUT\" | grep -Eq 'otel=https?://[^,]+/.'; then\n  echo \"grpc traces exporter cannot take a URL path; use proto=http\" >&2; exit 1\nfi","typeGuard":"function grpcAcceptsTracesLine(line) {\n  if (!line.includes('proto=grpc')) return true;\n  const m = line.match(/otel=(https?:\\/\\/[^,]+)/);\n  return !m || new URL(m[1]).pathname === '';\n}","tryCatchPattern":null,"preventionTips":["Pair URLs that contain /v1/traces with proto=http (or omit proto)","Address gRPC exporters by host:port only, typically the 4317 port","Keep one canonical traces flag per environment so URL/proto combinations are tested once"],"tags":["tracing","opentelemetry","grpc","protocol","configuration","k6"],"backgroundTag":"config-protocol-mismatch","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"}