grafana/k6 · error · ErrInvalidProto

invalid protocol: %q

Error message

invalid protocol: %q

What it means

A validation guard in parseProto that wraps ErrInvalidProto. It fires when the otel config's proto value is anything other than 'http' or 'grpc'. The at-fault input is the invalid proto string from the config line.

Source

Thrown at internal/lib/trace/otel.go:240

	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 nil
}

func (p *tracerProviderParams) parseHeader(header, value string) {
	headerName := strings.TrimPrefix(header, "header.")
	p.headers[headerName] = value
}

View on GitHub (pinned to 01ffac6f24)

Solutions

  1. Set proto=http or proto=grpc in the otel configuration
  2. Check for typos such as 'https' or 'HTTP' (matching is exact lowercase)
Defensive patterns

Strategy: validation

When it happens

Trigger: Thrown at internal/lib/trace/otel.go:240 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/1a2e2666594f8b66. Report an issue: GitHub.