grafana/k6 · error
HTTP exporter endpoint must only be host and port, no scheme
Error message
HTTP exporter endpoint must only be host and port, no scheme
What it means
The OTel HTTP exporter endpoint option takes only host:port — the OTel SDK adds the scheme based on the insecure flag and uses the separately-configured URL path. k6 therefore rejects endpoints that start with http:// or https:// with this error, so the scheme does not silently conflict with K6_OTEL_HTTP_EXPORTER_INSECURE / TLS settings.
Solutions
- Strip the scheme: K6_OTEL_HTTP_EXPORTER_ENDPOINT=otel-collector:4318
- Set the path separately via K6_OTEL_HTTP_EXPORTER_URL_PATH if you need a non-default path (default is /v1/metrics)
- For plaintext, set K6_OTEL_HTTP_EXPORTER_INSECURE=true instead of relying on http://
Example fix
# before export K6_OTEL_EXPORTER_PROTOCOL=http/protobuf export K6_OTEL_HTTP_EXPORTER_ENDPOINT=http://otel-collector:4318 # after export K6_OTEL_EXPORTER_PROTOCOL=http/protobuf export K6_OTEL_HTTP_EXPORTER_ENDPOINT=otel-collector:4318
Defensive patterns
Strategy: validation
Validate before calling
// Shell: normalize a full URL into endpoint + path
raw="${K6_OTEL_HTTP_EXPORTER_ENDPOINT:-}"
case "$raw" in
https://*) host=${raw#https://}; scheme_off=1 ;;
http://*) host=${raw#http://} ;;
*) host=$raw ;;
esac
endpoint=${host%%/*}; path=/${raw#*/}; [ "$path" = "/$raw" ] && unset path
export K6_OTEL_HTTP_EXPORTER_ENDPOINT=$endpoint
[ -n "${path:-}" ] && export K6_OTEL_HTTP_EXPORTER_URL_PATH=$path Type guard
function isBareHostPort(ep) {
return /^[^\/]+:\d+$/.test(ep);
} Prevention
- Translate OTEL_EXPORTER_OTLP_ENDPOINT values before reusing them for k6: strip the scheme, move the path to the URL-path variable
- Keep a normalization step in shared env scripts so full URLs never reach k6
- Use K6_OTEL_HTTP_EXPORTER_INSECURE=true for plaintext instead of http://
When it happens
Trigger: K6_OTEL_HTTP_EXPORTER_ENDPOINT=http://otel-collector:4318 (natural-looking but wrong); same with https://; configs ported from OTEL_EXPORTER_OTLP_ENDPOINT, which does allow full URLs.
Common situations: Copy-pasting the standard OTel env var value into k6's endpoint variable; assuming k6 accepts the same URL forms as the OTel SDK/collector.
Related errors
- HTTP exporter endpoint is required
- gRPC exporter endpoint is required
- invalid URL scheme
- failed to append root certificate to the pool
- grpc protocol does not support URL path
AI-assisted analysis of grafana/k6@01ffac6f24 (2026-08-18).
Data as JSON: /api/errors/7d05ae019ba20181.
Report an issue: GitHub.
Appendix: source
Thrown at internal/output/opentelemetry/config.go:246
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"
if !cfg.HTTPExporterInsecure.Bool {
endpoint += "s"
}
endpoint += "://" + cfg.HTTPExporterEndpoint.String + cfg.HTTPExporterURLPath.String
case grpcExporterProtocol:View on GitHub (pinned to 01ffac6f24)