{"record":{"id":"a7d95b7c331952b0","repo":"jaegertracing/jaeger","slug":"unable-to-parse-param-s-w","errorCode":null,"errorMessage":"unable to parse param '%s': %w","messagePattern":"unable to parse param '(.+?)': %w","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"cmd/jaeger/internal/extension/jaegerquery/internal/query_parser.go","lineNumber":226,"sourceCode":"\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":208,"sourceCodeEnd":228,"githubUrl":"https://github.com/jaegertracing/jaeger/blob/806f4447841ecdb60519f408b004a599d515f437/cmd/jaeger/internal/extension/jaegerquery/internal/query_parser.go#L208-L228","documentation":"newParseError is the single wrapping helper all query-parameter parsers (latencies, parseMetricsQueryParams, parseTime, parseDuration, parseBool, parseSpanKinds) use to annotate a parse failure with the parameter name, producing \"unable to parse param '%s': %w\". It tells the API caller exactly which query parameter was malformed and why. It is a message-structuring error, always caused by a lower-level parse failure.","triggerScenarios":"Any Jaeger query extension HTTP query where a parameter fails its parser: non-numeric latency values, timestamps outside RFC3339 for parseTime, invalid duration strings for parseDuration, non-boolean values for parseBool, or an unsupported span kind from mapSpanKindsToOpenTelemetry (error 211) wrapped with the param name.","commonSituations":"Hand-written client requests with ?start=2024-13-45 (invalid date), ?lookback=fortnight (invalid duration), ? SpanKind casing issues, or SDK clients whose time format changed between versions.","solutions":["Read the wrapped cause after the parameter name to see the exact parse failure and correct the value.","For times use RFC3339/UTC format; for durations use Go-style units (e.g. 1h30m); for booleans use true/false; for span kinds use the accepted OTel strings.","Validate query parameters client-side before building the request.","URL-encode values so stray characters do not corrupt parsing."],"exampleFix":"// before\nGET /api/traces?start=2024-01-01 10:00&end=never\n\n// after\nGET /api/traces?start=2024-01-01T10%3A00%3A00Z&end=2024-01-01T11%3A00%3A00Z&lookback=1h","handlingStrategy":"validation","validationCode":"func validateParams(p url.Values) error {\n    if v := p.Get(\"start\"); v != \"\" {\n        if _, err := time.Parse(time.RFC3339, v); err != nil {\n            return fmt.Errorf(\"start must be RFC3339: %w\", err)\n        }\n    }\n    if v := p.Get(\"lookback\"); v != \"\" {\n        if _, err := time.ParseDuration(v); err != nil {\n            return fmt.Errorf(\"lookback must be a Go duration: %w\", err)\n        }\n    }\n    return nil\n}","typeGuard":"func isRFC3339(s string) bool {\n    _, err := time.Parse(time.RFC3339, s)\n    return err == nil\n}","tryCatchPattern":"mq, err := parseMetricsQueryParams(r.URL.Query())\nif err != nil {\n    // err is 'unable to parse param <name>: <cause>'\n    http.Error(w, err.Error(), http.StatusBadRequest)\n    return\n}","preventionTips":["Build queries via the official Jaeger client libraries rather than string concatenation.","Use RFC3339 for timestamps and Go duration strings (1h, 30m) for lookback windows.","URL-encode all parameter values."],"tags":["query-params","validation","http-api"],"backgroundTag":"invalid-query-parameter","analyzedSha":"806f4447841ecdb60519f408b004a599d515f437","analyzedAt":"2026-09-01T02:39:22.140Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-08T05:18:18.240Z"}