grafana/k6 · error
grpc protocol does not support URL path
Error message
grpc protocol does not support URL path
What it means
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.
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
Example fix
# before k6 run --traces-output='otel=https://collector:4318/v1/traces,proto=grpc' script.js # after k6 run --traces-output='otel=http://collector:4318/v1/traces,proto=http' script.js
Defensive patterns
Strategy: validation
Validate before calling
// Wrapper: reject proto=grpc when the URL contains a path if echo "$TRACES_OUTPUT" | grep -q 'proto=grpc' && echo "$TRACES_OUTPUT" | grep -Eq 'otel=https?://[^,]+/.'; then echo "grpc traces exporter cannot take a URL path; use proto=http" >&2; exit 1 fi
Type guard
function grpcAcceptsTracesLine(line) {
if (!line.includes('proto=grpc')) return true;
const m = line.match(/otel=(https?:\/\/[^,]+)/);
return !m || new URL(m[1]).pathname === '';
} Prevention
- 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
When it happens
Trigger: --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.
Common situations: 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.
Related errors
- invalid protocol
- gRPC exporter endpoint is required
- invalid traces output
- invalid URL scheme
- unsupported exporter protocol
AI-assisted analysis of grafana/k6@01ffac6f24 (2026-08-18).
Data as JSON: /api/errors/e434671ad8bd02cb.
Report an issue: GitHub.
Appendix: source
Thrown at internal/lib/trace/otel.go:33
sdktrace "go.opentelemetry.io/otel/sdk/trace"
semconv "go.opentelemetry.io/otel/semconv/v1.20.0"
"go.opentelemetry.io/otel/trace"
"go.opentelemetry.io/otel/trace/noop"
"go.k6.io/k6/v2/internal/lib/strvals"
)
const serviceName = "k6"
var (
// ErrInvalidTracesOutput indicates that the defined traces output is not valid.
ErrInvalidTracesOutput = errors.New("invalid traces output")
// ErrInvalidProto indicates that the defined exporter protocol is not valid.
ErrInvalidProto = errors.New("invalid protocol")
// ErrInvalidURLScheme indicates that the defined exporter URL scheme is not valid.
ErrInvalidURLScheme = errors.New("invalid URL scheme")
// ErrInvalidGRPCWithURLPath indicates that an exporter using gRPC protocol does not support URL path.
ErrInvalidGRPCWithURLPath = errors.New("grpc protocol does not support URL path")
)
type (
tracerProvShutdownFunc func(ctx context.Context) error
)
// TracerProvider provides methods for tracers initialization and shutdown of the
// processing pipeline.
type TracerProvider struct {
trace.TracerProvider
shutdown tracerProvShutdownFunc
}
type tracerProviderParams struct {
proto string
endpoint string
urlPath string
insecure boolView on GitHub (pinned to 01ffac6f24)