grafana/k6 · error

gRPC exporter endpoint is required

Error message

gRPC exporter endpoint is required

What it means

Thrown by Config.validateExporterProtocol() for the OpenTelemetry output when exporterProtocol is gRPC and the gRPC exporter endpoint is empty. Once the protocol is resolved to gRPC, an endpoint is mandatory because the OTLP gRPC exporter has no usable default in this output.

Source

Thrown at internal/output/opentelemetry/config.go:236

		return err
	}
	return nil
}

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 {

View on GitHub (pinned to 93accf6570)

Solutions

  1. Set K6_OTEL_GRPC_EXPORTER_ENDPOINT, e.g. K6_OTEL_GRPC_EXPORTER_ENDPOINT=localhost:4317
  2. Or pass it inline: -o experimental-opentelemetry="exporterProtocol=grpc,grpcExporterEndpoint=localhost:4317"
  3. Verify no typo in the env var name and that it is exported in the same shell/job that runs k6

Example fix

# before
export K6_OTEL_EXPORTER_PROTOCOL=grpc
# no endpoint -> error

# after
export K6_OTEL_EXPORTER_PROTOCOL=grpc
export K6_OTEL_GRPC_EXPORTER_ENDPOINT=localhost:4317
Defensive patterns

Strategy: validation

Validate before calling

if [ "${K6_OTEL_EXPORTER_PROTOCOL:-}" = "grpc" ]; then
  : "${K6_OTEL_GRPC_EXPORTER_ENDPOINT:?K6_OTEL_GRPC_EXPORTER_ENDPOINT required for grpc protocol}"
fi

Prevention

When it happens

Trigger: Setting K6_OTEL_EXPORTER_PROTOCOL=grpc (or "exporterProtocol": "grpc") without K6_OTEL_GRPC_EXPORTER_ENDPOINT; unsetting the endpoint env var while keeping the protocol override; JSON output config with exporterProtocol grpc and no grpcExporterEndpoint field.

Common situations: Users switching from the default HTTP protocol to gRPC who set only the protocol flag; environment drift where the endpoint variable is defined in one CI stage but not the stage that runs k6; typos like K6_OTEL_GRPC_EXPORTER_ENDPONT.

Related errors


AI-assisted analysis of grafana/k6@93accf6570 (2026-08-15). Data as JSON: /api/errors/7facced162f2df86. Report an issue: GitHub.