{"record":{"id":"b5d94b43b844ccf2","repo":"grafana/k6","slug":"http-exporter-endpoint-is-required","errorCode":null,"errorMessage":"HTTP exporter endpoint is required","messagePattern":"HTTP exporter endpoint is required","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"internal/output/opentelemetry/config.go","lineNumber":241,"sourceCode":"func (cfg Config) validateExporterProtocol() error {\n\tif cfg.ExporterProtocol.String != \"\" {\n\t\tif cfg.ExporterProtocol.String != grpcExporterProtocol && cfg.ExporterProtocol.String != httpExporterProtocol {\n\t\t\treturn fmt.Errorf(\n\t\t\t\t\"unsupported exporter protocol %q, only %q and %q are supported\",\n\t\t\t\tcfg.ExporterProtocol.String,\n\t\t\t\tgrpcExporterProtocol,\n\t\t\t\thttpExporterProtocol,\n\t\t\t)\n\t\t}\n\t\tswitch cfg.ExporterProtocol.String {\n\t\tcase grpcExporterProtocol:\n\t\t\tif cfg.GRPCExporterEndpoint.String == \"\" {\n\t\t\t\treturn errors.New(\"gRPC exporter endpoint is required\")\n\t\t\t}\n\t\tcase httpExporterProtocol:\n\t\t\tendpoint := cfg.HTTPExporterEndpoint.String\n\t\t\tif endpoint == \"\" {\n\t\t\t\treturn errors.New(\"HTTP exporter endpoint is required\")\n\t\t\t}\n\n\t\t\tif strings.HasPrefix(endpoint, \"http://\") ||\n\t\t\t\tstrings.HasPrefix(endpoint, \"https://\") {\n\t\t\t\treturn errors.New(\"HTTP exporter endpoint must only be host and port, no scheme\")\n\t\t\t}\n\t\t}\n\t}\n\treturn nil\n}\n\n// String returns a string representation of the config\nfunc (cfg Config) String() string {\n\tvar endpoint string\n\tprotocol := cfg.ExporterProtocol.String\n\tswitch protocol {\n\tcase httpExporterProtocol:\n\t\tendpoint = \"http\"","sourceCodeStart":223,"sourceCodeEnd":259,"githubUrl":"https://github.com/grafana/k6/blob/93accf6570dcd306ca5e99cc44c393ee3797761b/internal/output/opentelemetry/config.go#L223-L259","documentation":"Thrown by Config.validateExporterProtocol() for the OpenTelemetry output when exporterProtocol is http/protobuf and the HTTP exporter endpoint is empty. The OTLP HTTP exporter needs a host:port endpoint; unlike some SDKs, this output does not fall back to a default collector address.","triggerScenarios":"Setting K6_OTEL_EXPORTER_PROTOCOL=http/protobuf (or the JSON equivalent) while K6_OTEL_HTTP_EXPORTER_ENDPOINT is unset or empty; removing the endpoint var after switching protocol from gRPC to http; a config file with exporterProtocol set but httpExporterEndpoint omitted.","commonSituations":"Assuming the exporter defaults to localhost:4318 like the OTel SDKs do; templated CI configs where the endpoint var is conditionally defined; leftover gRPC-era configs reused after switching to HTTP.","solutions":["Set K6_OTEL_HTTP_EXPORTER_ENDPOINT, e.g. K6_OTEL_HTTP_EXPORTER_ENDPOINT=localhost:4318","Or inline: -o experimental-opentelemetry=\"exporterProtocol=http/protobuf,httpExporterEndpoint=localhost:4318\"","Check the variable is non-empty in the actual runtime environment (print it before running k6)"],"exampleFix":"# before\nexport K6_OTEL_EXPORTER_PROTOCOL=http/protobuf\n# no endpoint -> error\n\n# after\nexport K6_OTEL_EXPORTER_PROTOCOL=http/protobuf\nexport K6_OTEL_HTTP_EXPORTER_ENDPOINT=localhost:4318","handlingStrategy":"validation","validationCode":"if [ \"${K6_OTEL_EXPORTER_PROTOCOL:-http/protobuf}\" = \"http/protobuf\" ]; then\n  : \"${K6_OTEL_HTTP_EXPORTER_ENDPOINT:?K6_OTEL_HTTP_EXPORTER_ENDPOINT required, host:port only}\"\nfi","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Do not assume an OTLP default endpoint; always set it explicitly","Standardize one protocol across the team to avoid per-protocol endpoint confusion","Verify env vars are exported in the same CI stage that runs k6"],"tags":["k6","opentelemetry","otlp","http","endpoint","config"],"backgroundTag":null,"analyzedSha":"93accf6570dcd306ca5e99cc44c393ee3797761b","analyzedAt":"2026-08-15T21:23:27.118Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}