{"record":{"id":"388e05acebb94872","repo":"jaegertracing/jaeger","slug":"cannot-send-the-query-filter-w","errorCode":null,"errorMessage":"cannot send the query filter: %w","messagePattern":"cannot send the query filter: %w","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"internal/storage/v2/grpc/tracereader.go","lineNumber":266,"sourceCode":"\t\t\tMinStartTime:      jptrace.UnixNanoToTime(ps.GetMinStartTimeUnixNano()),\n\t\t\tMaxEndTime:        jptrace.UnixNanoToTime(ps.GetMaxEndTimeUnixNano()),\n\t\t\tSpanCount:         int(ps.GetSpanCount()),\n\t\t\tErrorSpanCount:    int(ps.GetErrorSpanCount()),\n\t\t\tOrphanSpanCount:   int(ps.GetOrphanSpanCount()),\n\t\t\tServices:          svcs,\n\t\t}\n\t}\n\treturn batch\n}\n\n// toProtoQueryParameters encodes a query for the remote server. Encoding the filter can fail, for\n// a tree the wire has no form for, and asking here rather than at each RPC keeps that one refusal in\n// one place: the alternative is sending a query whose filter went missing, which reads to the server\n// as a search with no predicates.\nfunc toProtoQueryParameters(t tracestore.TraceQueryParams) (*storage.TraceQueryParameters, error) {\n\tfilter, err := expressionproto.ToProto(t.Filter)\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"cannot send the query filter: %w\", err)\n\t}\n\treturn &storage.TraceQueryParameters{\n\t\tServiceName:   t.ServiceName,\n\t\tOperationName: t.OperationName,\n\t\tAttributes:    convertMapToKeyValueList(t.Attributes),\n\t\tStartTimeMin:  t.StartTimeMin,\n\t\tStartTimeMax:  t.StartTimeMax,\n\t\tDurationMin:   t.DurationMin,\n\t\tDurationMax:   t.DurationMax,\n\t\tSearchDepth:   int32(t.SearchDepth), //nolint:gosec // G115\n\t\tFilter:        filter,\n\t}, nil\n}\n\nfunc convertMapToKeyValueList(m pcommon.Map) []*storage.KeyValue {\n\tkeyValues := make([]*storage.KeyValue, 0, m.Len())\n\tm.Range(func(k string, v pcommon.Value) bool {\n\t\tkeyValues = append(keyValues, &storage.KeyValue{","sourceCodeStart":248,"sourceCodeEnd":284,"githubUrl":"https://github.com/jaegertracing/jaeger/blob/806f4447841ecdb60519f408b004a599d515f437/internal/storage/v2/grpc/tracereader.go#L248-L284","documentation":"toProtoQueryParameters converts tracestore.TraceQueryParams (including its Filter expression tree) into the wire proto. If the filter expression cannot be represented in the protobuf form (expressionproto.ToProto fails), conversion aborts with this error rather than silently dropping predicates — a filter-less query would read to the server as an unrestricted search.","triggerScenarios":"Passing TraceQueryParams with a Filter whose expression tree has no proto representation (unsupported operators, malformed/nested expressions) into FindTraces, FindTraceIDs, or FindTraceSummaries via toProtoQueryParameters.","commonSituations":"Using filter operators not yet supported by the proto schema; constructing expressions programmatically with invalid nesting; version mismatch where client expressions exceed server wire capabilities.","solutions":["Inspect the wrapped ToProto error to find the unsupported expression node","Simplify or remove unsupported operators from the filter","Express unsupported predicates as attribute filters if possible","Upgrade to a client/proto version supporting the expression form"],"exampleFix":"// before\nparams.Filter = unsupportedExpr // e.g. unknown operator tree\n// after\nparams.Filter = expr.And(expr.Eq(\"service.name\", \"svc\"), expr.Gt(\"duration\", n)) // supported forms only","handlingStrategy":"validation","validationCode":"if t.Filter != nil {\n    if err := exprValidateSupportedOperators(t.Filter); err != nil {\n        return fmt.Errorf(\"filter not sendable: %w\", err)\n    }\n}","typeGuard":"func sendableFilter(f expression.Filter) bool {\n    ok, err := expressionproto.ToProto(f) == nil // probe conversion\n    return ok && err == nil\n}","tryCatchPattern":null,"preventionTips":["Restrict filters to operators known to round-trip through the proto schema","Test ToProto conversion of user-built filters at admission time","Keep expression proto definitions in sync with the client library","Never send queries with silently dropped filters"],"tags":["validation","query-filter","proto"],"backgroundTag":"query-filter-not-representable","analyzedSha":"806f4447841ecdb60519f408b004a599d515f437","analyzedAt":"2026-09-01T02:39:22.140Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-08T05:18:18.240Z"}