{"record":{"id":"1f4ad8e81f91ecc8","repo":"jaegertracing/jaeger","slug":"w-it-can-carry-only-one-predicate-on-q","errorCode":null,"errorMessage":"%w: it can carry only one predicate on %q","messagePattern":"%w: it can carry only one predicate on %q","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"internal/storage/v2/api/tracestore/shape.go","lineNumber":295,"sourceCode":"func errNotADuration(name string, value expression.Expression) error {\n\tif constant, ok := value.(*expression.AnyValue); ok {\n\t\treturn fmt.Errorf(\"%w: the bound %q on %q was never read as a duration\",\n\t\t\tErrFilterInvalid, constant.Value, name)\n\t}\n\treturn fmt.Errorf(`%w: it compares %q against a duration such as \"2s\" only`,\n\t\tErrFilterUnsupported, name)\n}\n\nfunc errUnsupportedOperator(op expression.Operator) error {\n\treturn fmt.Errorf(\"%w: it does not support the operator %q\", ErrFilterUnsupported, op)\n}\n\nfunc errUnsupportedOperatorOn(op expression.Operator, name string) error {\n\treturn fmt.Errorf(\"%w: it does not support the operator %q on %q\", ErrFilterUnsupported, op, name)\n}\n\nfunc errRepeatedPredicateOn(name string) error {\n\treturn fmt.Errorf(\"%w: it can carry only one predicate on %q\", ErrFilterUnsupported, name)\n}\n","sourceCodeStart":277,"sourceCodeEnd":297,"githubUrl":"https://github.com/jaegertracing/jaeger/blob/806f4447841ecdb60519f408b004a599d515f437/internal/storage/v2/api/tracestore/shape.go#L277-L297","documentation":"Each legacy scalar field holds a single value: one entry per attribute key, one ServiceName, one OperationName, one DurationMin and one DurationMax. When the filter's flat conjunction contains two predicates on the same field — the same attribute key twice, two service-name equalities, two min bounds — the second cannot be stored, so applyAttribute/applyText/applyDurationBound refuse it with ErrFilterUnsupported naming the field. Note this occurs even when the two predicates are identical, since AND-ing equal predicates still needs two slots.","triggerScenarios":"ToLegacyShape() processes a conjunction containing two OpEq predicates on the same attribute key, two equalities on span.name or resource.service, or two OpGte (or two OpLte) bounds on span.duration.","commonSituations":"A UI accumulates duplicate filter chips without deduplication; query builders append the same condition twice; users express name in ('a','b') as two name == predicates, which OR semantics cannot map onto one legacy slot.","solutions":["Deduplicate predicates on the same field before building the filter; keep only one per field/key.","Express multiple allowed values via an IN-style construct or issue one query per value and merge results.","Target a backend with native filter support where repeated predicates are conjoined natively."],"exampleFix":"// before\npreds := []Expression{eq(\"service.name\",\"a\"), eq(\"service.name\",\"a\")} // duplicate\n// after — dedupe before building the conjunction\nseen := map[string]bool{}; var unique []Expression\nfor _, p := range preds { key := refKeyOf(p); if !seen[key] { seen[key] = true; unique = append(unique, p) } }","handlingStrategy":"validation","validationCode":"func dedupePredicates(preds []*expression.Call) []*expression.Call {\n  seen := map[string]bool{}; out := preds[:0]\n  for _, p := range preds {\n    key := fmt.Sprintf(\"%T|%v\", p.Args[0], p.Args[0])\n    k2 := refKey(p) // e.g. attribute key or level+name\n    if seen[k2] { continue }\n    seen[k2] = true; out = append(out, p)\n  }\n  return out\n}","typeGuard":null,"tryCatchPattern":"legacy, err := params.ToLegacyShape()\nif errors.Is(err, tracestore.ErrFilterUnsupported) {\n  return nil, fmt.Errorf(\"only one predicate per field is supported: %w\", err)\n}","preventionTips":["Deduplicate filter conditions per field/key before building the query","Merge duplicate UI filter chips into one condition","Issue one query per alternative value instead of repeating the field"],"tags":["jaeger","tracestore","filter-unsupported","duplicate-predicate"],"backgroundTag":"duplicate-query-predicate","analyzedSha":"806f4447841ecdb60519f408b004a599d515f437","analyzedAt":"2026-09-01T02:39:22.140Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-08T05:18:18.240Z"}