{"record":{"id":"b7d8857f1691475e","repo":"jaegertracing/jaeger","slug":"invalid-jaeger-tag-pair-q-expected-key-value","errorCode":null,"errorMessage":"invalid Jaeger tag pair %q, expected key=value","messagePattern":"invalid Jaeger tag pair %q, expected key=value","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"cmd/internal/flags/flags.go","lineNumber":51,"sourceCode":"\t\terr := v.ReadInConfig()\n\t\tif err != nil {\n\t\t\treturn fmt.Errorf(\"cannot load config file %s: %w\", file, err)\n\t\t}\n\t}\n\treturn nil\n}\n\n// ParseJaegerTags parses the Jaeger tags string into a map.\nfunc ParseJaegerTags(jaegerTags string) (map[string]string, error) {\n\tif jaegerTags == \"\" {\n\t\treturn nil, nil\n\t}\n\ttagPairs := strings.Split(string(jaegerTags), \",\")\n\ttags := make(map[string]string)\n\tfor _, p := range tagPairs {\n\t\tkv := strings.SplitN(p, \"=\", 2)\n\t\tif len(kv) != 2 {\n\t\t\treturn nil, fmt.Errorf(\"invalid Jaeger tag pair %q, expected key=value\", p)\n\t\t}\n\t\tk, v := strings.TrimSpace(kv[0]), strings.TrimSpace(kv[1])\n\n\t\tif strings.HasPrefix(v, \"${\") && strings.HasSuffix(v, \"}\") {\n\t\t\tskipWhenEmpty := false\n\n\t\t\ted := strings.SplitN(string(v[2:len(v)-1]), \":\", 2)\n\t\t\tif len(ed) == 1 {\n\t\t\t\t// no default value specified, set to empty\n\t\t\t\tskipWhenEmpty = true\n\t\t\t\ted = append(ed, \"\")\n\t\t\t}\n\n\t\t\te, d := ed[0], ed[1]\n\t\t\tv = os.Getenv(e)\n\t\t\tif v == \"\" && d != \"\" {\n\t\t\t\tv = d\n\t\t\t}","sourceCodeStart":33,"sourceCodeEnd":69,"githubUrl":"https://github.com/jaegertracing/jaeger/blob/806f4447841ecdb60519f408b004a599d515f437/cmd/internal/flags/flags.go#L33-L69","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","solutions":["Fix the reported pair to key=value form (the offending token is quoted in the error).","Remove empty entries caused by trailing or doubled commas.","Quote the whole flag value in the shell so '=' and ',' survive parsing.","Validate the tag string with the existing TestParseJaegerTags cases before deploying."],"exampleFix":"// before\n--jaeger.tags=env,version=1.0\n// after\n--jaeger.tags=env=prod,version=1.0","handlingStrategy":"validation","validationCode":"for _, p := range strings.Split(tagsFlag, \",\") {\n    if p == \"\" || !strings.Contains(p, \"=\") {\n        return fmt.Errorf(\"bad tag pair %q\", p)\n    }\n}","typeGuard":null,"tryCatchPattern":"tags, err := flags.ParseJaegerTags(input)\nif err != nil {\n    // err names the offending pair in %q; fix and retry\n    return fmt.Errorf(\"tag parsing: %w\", err)\n}","preventionTips":["Quote the whole --jaeger.tags value in shell/manifests.","Avoid trailing commas and empty entries in tag lists.","Test tag strings with ParseJaegerTags unit tests before rollout."],"tags":["cli","validation","tags"],"backgroundTag":"invalid-key-value-pair","analyzedSha":"806f4447841ecdb60519f408b004a599d515f437","analyzedAt":"2026-09-01T02:39:22.140Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-08T05:18:18.240Z"}