grafana/k6 · error

unknown otel config key %s

Error message

unknown otel config key %s

What it means

A validation guard in tracerProviderParamsFromConfigLine (K6_OTEL configuration parsing). It fires when an OTEL config line contains a key other than the recognized ones: 'otel' (URL), 'proto' (protocol), or a 'header.'-prefixed key. The at-fault input is the unrecognized key string from the K6_OTEL environment variable / config line.

Source

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

		var err error
		switch key {
		case "otel":
			err = params.parseURL(value)
			if err != nil {
				return params, fmt.Errorf("couldn't parse the otel URL: %w", err)
			}
		case "proto":
			err = params.parseProto(value)
			if err != nil {
				return params, fmt.Errorf("couldn't parse the otel proto: %w", err)
			}
		default:
			if strings.HasPrefix(key, "header.") {
				params.parseHeader(key, value)
				continue
			}
			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)

View on GitHub (pinned to 01ffac6f24)

Solutions

  1. Use only supported keys in the OTEL config: otel=<url>, proto=<http|grpc>, header.<name>=<value>
  2. Check for typos in the config key (e.g. 'header' keys must start with 'header.')
  3. See the k6 OpenTelemetry documentation for the accepted configuration format
Defensive patterns

Strategy: validation

When it happens

Trigger: Thrown at internal/lib/trace/otel.go:209 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/63126a26367e0dd9. Report an issue: GitHub.