{"record":{"id":"d46cca4d0d6ad94e","repo":"jaegertracing/jaeger","slug":"unsupported-span-kind-s","errorCode":null,"errorMessage":"unsupported span kind: '%s'","messagePattern":"unsupported span kind: '(.+?)'","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"cmd/jaeger/internal/extension/jaegerquery/internal/query_parser.go","lineNumber":218,"sourceCode":"func parseSpanKinds(r *http.Request, paramName string, defaultSpanKinds []string) ([]string, error) {\n\tquery := r.URL.Query()\n\tjaegerSpanKinds, ok := query[paramName]\n\tif !ok {\n\t\treturn defaultSpanKinds, nil\n\t}\n\totelSpanKinds, err := mapSpanKindsToOpenTelemetry(jaegerSpanKinds)\n\tif err != nil {\n\t\treturn defaultSpanKinds, newParseError(err, paramName)\n\t}\n\treturn otelSpanKinds, nil\n}\n\nfunc mapSpanKindsToOpenTelemetry(spanKinds []string) ([]string, error) {\n\totelSpanKinds := make([]string, len(spanKinds))\n\tfor i, spanKind := range spanKinds {\n\t\tv := jptrace.StringToProtoSpanKind(spanKind)\n\t\tif v == \"\" {\n\t\t\treturn otelSpanKinds, fmt.Errorf(\"unsupported span kind: '%s'\", spanKind)\n\t\t}\n\t\totelSpanKinds[i] = v\n\t}\n\treturn otelSpanKinds, nil\n}\n\nfunc newParseError(err error, paramName string) error {\n\treturn fmt.Errorf(\"unable to parse param '%s': %w\", paramName, err)\n}\n","sourceCodeStart":200,"sourceCodeEnd":228,"githubUrl":"https://github.com/jaegertracing/jaeger/blob/806f4447841ecdb60519f408b004a599d515f437/cmd/jaeger/internal/extension/jaegerquery/internal/query_parser.go#L200-L228","documentation":"mapSpanKindsToOpenTelemetry converts user-supplied span kind strings (e.g. from a query parameter) to OpenTelemetry span kind names using jptrace.StringToProtoSpanKind. If the conversion returns an empty string, the input was not a recognized span kind and the function fails with \"unsupported span kind: '%s'\". parseSpanKinds propagates it (wrapped by newParseError) when the spanKinds parameter is present in a metrics or search query.","triggerScenarios":"parseSpanKinds -> mapSpanKindsToOpenTelemetry is given a spanKinds list containing any string for which jptrace.StringToProtoSpanKind returns \"\": misspelled values (\"server\" vs \"unspecified\" casing variants are matched by the helper, so e.g. \"SERVER \", \"served\", \"client-side\" fail), empty strings in the list, or arbitrary values passed via the query API.","commonSituations":"API users pass span kinds with typos or extra whitespace (\"inernal\"), use Jaeger-legacy kind names or numeric kinds (\"2\") not accepted by the OTel string mapping, or send an empty value like ?spanKind=.","solutions":["Use the exact accepted OTel span kind strings: unspecified, internal, server, client, producer, consumer.","Trim and normalize the spanKinds values before sending (no extra spaces, correct casing per the API's accepted set).","Check the wrapped error from parseSpanKinds — it names the offending parameter and the raw value via this message.","Consult the Jaeger query API docs for the spanKind parameter's accepted vocabulary."],"exampleFix":"// before\nGET /api/metrics/latencies?spanKind=SERVER&...\nGET /api/traces?spanKind=3&...\n\n// after\nGET /api/metrics/latencies?spanKind=server&...\nGET /api/traces?spanKind=consumer&...","handlingStrategy":"validation","validationCode":"var validKinds = map[string]bool{\n    \"unspecified\": true, \"internal\": true, \"server\": true,\n    \"client\": true, \"producer\": true, \"consumer\": true,\n}\nfor _, k := range strings.Split(spanKindsParam, \",\") {\n    if !validKinds[strings.TrimSpace(k)] {\n        return fmt.Errorf(\"invalid span kind: %q\", k)\n    }\n}","typeGuard":"func isValidSpanKind(s string) bool {\n    switch s {\n    case \"unspecified\", \"internal\", \"server\", \"client\", \"producer\", \"consumer\":\n        return true\n    }\n    return false\n}","tryCatchPattern":"otelKinds, err := parseSpanKinds(params.SpanKinds)\nif err != nil {\n    http.Error(w, err.Error(), http.StatusBadRequest) // message names the bad value\n    return\n}","preventionTips":["Keep a client-side allow-list of span kind strings derived from the API docs.","Trim whitespace and lowercase inputs before sending.","Never send numeric span kinds; use the string names."],"tags":["query-params","validation","tracing","opentelemetry"],"backgroundTag":"invalid-enum-value","analyzedSha":"806f4447841ecdb60519f408b004a599d515f437","analyzedAt":"2026-09-01T02:39:22.140Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-08T05:18:18.240Z"}