{"record":{"id":"7d05ae019ba20181","repo":"grafana/k6","slug":"http-exporter-endpoint-must-only-be-host-and-port","errorCode":null,"errorMessage":"HTTP exporter endpoint must only be host and port, no scheme","messagePattern":"HTTP exporter endpoint must only be host and port, no scheme","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"internal/output/opentelemetry/config.go","lineNumber":246,"sourceCode":"\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\"\n\t\tif !cfg.HTTPExporterInsecure.Bool {\n\t\t\tendpoint += \"s\"\n\t\t}\n\t\tendpoint += \"://\" + cfg.HTTPExporterEndpoint.String + cfg.HTTPExporterURLPath.String\n\tcase grpcExporterProtocol:","sourceCodeStart":228,"sourceCodeEnd":264,"githubUrl":"https://github.com/grafana/k6/blob/01ffac6f245854c1b8adc6a69857c76a15f90022/internal/output/opentelemetry/config.go#L228-L264","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","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://"],"exampleFix":"# before\nexport K6_OTEL_EXPORTER_PROTOCOL=http/protobuf\nexport K6_OTEL_HTTP_EXPORTER_ENDPOINT=http://otel-collector:4318\n# after\nexport K6_OTEL_EXPORTER_PROTOCOL=http/protobuf\nexport K6_OTEL_HTTP_EXPORTER_ENDPOINT=otel-collector:4318","handlingStrategy":"validation","validationCode":"// Shell: normalize a full URL into endpoint + path\nraw=\"${K6_OTEL_HTTP_EXPORTER_ENDPOINT:-}\"\ncase \"$raw\" in\n  https://*) host=${raw#https://}; scheme_off=1 ;;\n  http://*)  host=${raw#http://} ;;\n  *) host=$raw ;;\nesac\nendpoint=${host%%/*}; path=/${raw#*/}; [ \"$path\" = \"/$raw\" ] && unset path\nexport K6_OTEL_HTTP_EXPORTER_ENDPOINT=$endpoint\n[ -n \"${path:-}\" ] && export K6_OTEL_HTTP_EXPORTER_URL_PATH=$path","typeGuard":"function isBareHostPort(ep) {\n  return /^[^\\/]+:\\d+$/.test(ep);\n}","tryCatchPattern":null,"preventionTips":["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://"],"tags":["opentelemetry","http","endpoint","url","configuration","k6"],"backgroundTag":"invalid-url-scheme","analyzedSha":"01ffac6f245854c1b8adc6a69857c76a15f90022","analyzedAt":"2026-08-18T03:05:52.393Z","contentChangedAt":"2026-08-18T03:05:52.393Z","schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}