grafana/k6 · error
HTTP exporter endpoint is required
Error message
HTTP exporter endpoint is required
What it means
When the OTel exporter protocol is http/protobuf, the output requires an HTTP endpoint (host:port). k6 defaults it to localhost:4318, so the check fails when the default has been overridden with an empty value — K6_OTEL_HTTP_EXPORTER_ENDPOINT set to empty (or "httpExporterEndpoint": "" in JSON config) while the protocol is http/protobuf.
Solutions
- Set a host:port value, e.g. export K6_OTEL_HTTP_EXPORTER_ENDPOINT=otel-collector:4318
- Remove the empty variable so the localhost:4318 default applies
- Remember the URL path is configured separately via K6_OTEL_HTTP_EXPORTER_URL_PATH (default /v1/metrics) — do not put the path in the endpoint
Example fix
# before export K6_OTEL_EXPORTER_PROTOCOL=http/protobuf export K6_OTEL_HTTP_EXPORTER_ENDPOINT= k6 run -o opentelemetry script.js # after export K6_OTEL_EXPORTER_PROTOCOL=http/protobuf export K6_OTEL_HTTP_EXPORTER_ENDPOINT=otel-collector:4318 k6 run -o opentelemetry script.js
Defensive patterns
Strategy: validation
Validate before calling
// Shell
if [ "${K6_OTEL_EXPORTER_PROTOCOL:-}" = "http/protobuf" ] && [ -z "${K6_OTEL_HTTP_EXPORTER_ENDPOINT:-}" ]; then
unset K6_OTEL_HTTP_EXPORTER_ENDPOINT # restore localhost:4318 default
fi Prevention
- Remember the HTTP protocol's full k6 name is http/protobuf, not http
- Keep endpoint (host:port) and URL path (K6_OTEL_HTTP_EXPORTER_URL_PATH) in separate variables
- Pre-flight-validate that switching protocols brought its matching endpoint along
When it happens
Trigger: export K6_OTEL_EXPORTER_PROTOCOL=http/protobuf together with K6_OTEL_HTTP_EXPORTER_ENDPOINT= (empty); a JSON output config that selects the HTTP protocol but blanks the endpoint; CI variables that exist but are unpopulated.
Common situations: Switching a pipeline from grpc to HTTP export and clearing the old-style endpoint; templated configs where the endpoint variable is provisioned per-environment and this one is missing.
Related errors
- HTTP exporter endpoint must only be host and port, no scheme
- gRPC exporter endpoint is required
- failed to append root certificate to the pool
- grpc protocol does not support URL path
- invalid protocol
AI-assisted analysis of grafana/k6@01ffac6f24 (2026-08-18).
Data as JSON: /api/errors/b5d94b43b844ccf2.
Report an issue: GitHub.
Appendix: source
Thrown at internal/output/opentelemetry/config.go:241
func (cfg Config) validateExporterProtocol() error {
if cfg.ExporterProtocol.String != "" {
if cfg.ExporterProtocol.String != grpcExporterProtocol && cfg.ExporterProtocol.String != httpExporterProtocol {
return fmt.Errorf(
"unsupported exporter protocol %q, only %q and %q are supported",
cfg.ExporterProtocol.String,
grpcExporterProtocol,
httpExporterProtocol,
)
}
switch cfg.ExporterProtocol.String {
case grpcExporterProtocol:
if cfg.GRPCExporterEndpoint.String == "" {
return errors.New("gRPC exporter endpoint is required")
}
case httpExporterProtocol:
endpoint := cfg.HTTPExporterEndpoint.String
if endpoint == "" {
return errors.New("HTTP exporter endpoint is required")
}
if strings.HasPrefix(endpoint, "http://") ||
strings.HasPrefix(endpoint, "https://") {
return errors.New("HTTP exporter endpoint must only be host and port, no scheme")
}
}
}
return nil
}
// String returns a string representation of the config
func (cfg Config) String() string {
var endpoint string
protocol := cfg.ExporterProtocol.String
switch protocol {
case httpExporterProtocol:
endpoint = "http"View on GitHub (pinned to 01ffac6f24)