jaegertracing/jaeger · error

invalid Jaeger tag pair %q, expected key=value

Error message

invalid Jaeger tag pair %q, expected key=value

What it means

ParseJaegerTags splits the --jaeger.tags value on commas and requires each pair to contain an '='. Any comma-separated token without a key=value shape produces this error naming the offending pair. It is strict input validation of the process tag list.

Source

Thrown at cmd/internal/flags/flags.go:51

		err := v.ReadInConfig()
		if err != nil {
			return fmt.Errorf("cannot load config file %s: %w", file, err)
		}
	}
	return nil
}

// ParseJaegerTags parses the Jaeger tags string into a map.
func ParseJaegerTags(jaegerTags string) (map[string]string, error) {
	if jaegerTags == "" {
		return nil, nil
	}
	tagPairs := strings.Split(string(jaegerTags), ",")
	tags := make(map[string]string)
	for _, p := range tagPairs {
		kv := strings.SplitN(p, "=", 2)
		if len(kv) != 2 {
			return nil, fmt.Errorf("invalid Jaeger tag pair %q, expected key=value", p)
		}
		k, v := strings.TrimSpace(kv[0]), strings.TrimSpace(kv[1])

		if strings.HasPrefix(v, "${") && strings.HasSuffix(v, "}") {
			skipWhenEmpty := false

			ed := strings.SplitN(string(v[2:len(v)-1]), ":", 2)
			if len(ed) == 1 {
				// no default value specified, set to empty
				skipWhenEmpty = true
				ed = append(ed, "")
			}

			e, d := ed[0], ed[1]
			v = os.Getenv(e)
			if v == "" && d != "" {
				v = d
			}

View on GitHub (pinned to 806f444784)

Solutions

  1. Fix the reported pair to key=value form (the offending token is quoted in the error).
  2. Remove empty entries caused by trailing or doubled commas.
  3. Quote the whole flag value in the shell so '=' and ',' survive parsing.
  4. Validate the tag string with the existing TestParseJaegerTags cases before deploying.

Example fix

// before
--jaeger.tags=env,version=1.0
// after
--jaeger.tags=env=prod,version=1.0
Defensive patterns

Strategy: validation

Validate before calling

for _, p := range strings.Split(tagsFlag, ",") {
    if p == "" || !strings.Contains(p, "=") {
        return fmt.Errorf("bad tag pair %q", p)
    }
}

Try / catch

tags, err := flags.ParseJaegerTags(input)
if err != nil {
    // err names the offending pair in %q; fix and retry
    return fmt.Errorf("tag parsing: %w", err)
}

Prevention

When it happens

Trigger: Passing a tags string like "key1,,key3=value" (empty token), "envonly" (no '='), or a value containing a stray comma, so strings.SplitN yields a slice of length != 2.

Common situations: Hand-written flag values in manifests; copying tag lists from docs with a trailing comma; shell quoting stripping an '='; generating tags from a template that emits empty entries.

Related errors


AI-assisted analysis of jaegertracing/jaeger@806f444784 (2026-09-01). Data as JSON: /api/errors/b7d8857f1691475e. Report an issue: GitHub.