grafana/k6 · error · ErrInvalidURLScheme
invalid URL scheme: %q
Error message
invalid URL scheme: %q
What it means
A validation guard in parseURL that wraps ErrInvalidURLScheme. It fires when the URL given in the otel config uses a scheme other than http or https (e.g. grpc:// or ftp://). The at-fault input is the malformed otel URL's scheme.
Source
Thrown at internal/lib/trace/otel.go:227
return params, fmt.Errorf("unknown otel config key %s", key)
}
}
if params.proto == "grpc" && params.urlPath != "" {
return params, ErrInvalidGRPCWithURLPath
}
return params, nil
}
func (p *tracerProviderParams) parseURL(s string) error {
u, err := url.Parse(s)
if err != nil {
return err
}
if u.Scheme != "http" && u.Scheme != "https" {
return fmt.Errorf("%w: %q", ErrInvalidURLScheme, u.Scheme)
}
p.proto = "http"
p.endpoint = u.Host
p.urlPath = u.Path
p.insecure = u.Scheme == "http"
return nil
}
func (p *tracerProviderParams) parseProto(proto string) error {
if proto != "http" && proto != "grpc" {
return fmt.Errorf("%w: %q", ErrInvalidProto, proto)
}
p.proto = proto
return nilView on GitHub (pinned to 01ffac6f24)
Solutions
- Use an http:// or https:// URL for the otel endpoint
- For gRPC protocol, set proto=grpc and give the host:port endpoint without a URL path
- Check that the URL was not truncated or corrupted in the config
Defensive patterns
Strategy: validation
When it happens
Trigger: Thrown at internal/lib/trace/otel.go:227 when the library encounters an invalid state.
Common situations: See trigger scenarios.
AI-assisted analysis of grafana/k6@01ffac6f24 (2026-08-18).
Data as JSON: /api/errors/ebad2ae1bf186d22.
Report an issue: GitHub.