{"record":{"id":"84225729ccb4d887","repo":"jaegertracing/jaeger","slug":"could-not-find-aggregation-of-traceids","errorCode":null,"errorMessage":"could not find aggregation of traceIDs","messagePattern":"could not find aggregation of traceIDs","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"info","filePath":"internal/storage/v1/badger/spanstore/reader.go","lineNumber":43,"sourceCode":"\nvar (\n\t// ErrServiceNameNotSet occurs when attempting to query with an empty service name\n\tErrServiceNameNotSet = errors.New(\"service name must be set\")\n\n\t// ErrStartTimeMinGreaterThanMax occurs when start time min is above start time max\n\tErrStartTimeMinGreaterThanMax = errors.New(\"min start time is above max\")\n\n\t// ErrDurationMinGreaterThanMax occurs when duration min is above duration max\n\tErrDurationMinGreaterThanMax = errors.New(\"min duration is above max\")\n\n\t// ErrMalformedRequestObject occurs when a request object is nil\n\tErrMalformedRequestObject = errors.New(\"malformed request object\")\n\n\t// ErrStartAndEndTimeNotSet occurs when start time and end time are not set\n\tErrStartAndEndTimeNotSet = errors.New(\"start and end time must be set\")\n\n\t// ErrUnableToFindTraceIDAggregation occurs when an aggregation query for TraceIDs fail.\n\tErrUnableToFindTraceIDAggregation = errors.New(\"could not find aggregation of traceIDs\")\n\n\t// ErrNotSupported during development, don't support every option - yet\n\tErrNotSupported = errors.New(\"this query parameter is not supported yet\")\n\n\t// ErrInternalConsistencyError indicates internal data consistency issue\n\tErrInternalConsistencyError = errors.New(\"internal data consistency issue\")\n)\n\nconst (\n\tdefaultNumTraces = 100\n\tsizeOfTraceID    = 16\n\tencodingTypeBits = 0x0F\n)\n\n// TraceReader reads traces from the local badger store\ntype TraceReader struct {\n\tstore *badger.DB\n\tcache *CacheStore","sourceCodeStart":25,"sourceCodeEnd":61,"githubUrl":"https://github.com/jaegertracing/jaeger/blob/806f4447841ecdb60519f408b004a599d515f437/internal/storage/v1/badger/spanstore/reader.go#L25-L61","documentation":"ErrUnableToFindTraceIDAggregation is the badger reader's sentinel for a failed trace-ID aggregation step (declared for the path where the index/aggregation pass cannot produce the trace-ID set). In the current badger implementation it is effectively a legacy/defensive declaration: the index-seek and scan code paths return raw errors instead. If seen, it means the query planner could not assemble the traceID candidate list.","triggerScenarios":"Conceptually triggered from findTraceIDsFromQuery when the aggregation/index-join over trace IDs yields no usable result. In the shipped code the error variable is declared but not returned by any active call site, so encountering it by errors.Is is essentially impossible in current builds.","commonSituations":"Reading old Jaeger documentation or vendored code that references this error; porting code that handled it from the ES/Cassandra aggregation-based backends; confusion when mapping backend-specific errors across badger/ES/Cassandra.","solutions":["Treat it as dead/legacy for the badger backend; handle the concrete errors from FindTraceIDs instead.","If you maintain a fork where it is returned, inspect the index data/cache consistency and re-run the query with a narrower time window.","Handle it defensively with errors.Is alongside ErrTraceNotFound so cross-backend error handling stays uniform."],"exampleFix":"// before\nif err != nil {\n\treturn err // opaque failure\n}\n// after\nif errors.Is(err, spanstore.ErrUnableToFindTraceIDAggregation) {\n\tlog.Warn(\"trace ID aggregation failed; falling back to time-range scan\")\n}\nif err != nil {\n\treturn err\n}","handlingStrategy":"try-catch","validationCode":null,"typeGuard":"func isAggregationFailure(err error) bool {\n\treturn errors.Is(err, spanstore.ErrUnableToFindTraceIDAggregation)\n}","tryCatchPattern":"ids, err := reader.FindTraceIDs(ctx, q)\nswitch {\ncase errors.Is(err, spanstore.ErrUnableToFindTraceIDAggregation):\n\tlog.Warn(\"trace ID aggregation unavailable; retrying with narrower window\")\n\tids, err = reader.FindTraceIDs(ctx, narrowedWindow(q))\n\tif err != nil { return nil, err }\ncase err != nil:\n\treturn nil, err\n}","preventionTips":["Do not special-case this legacy sentinel in new code; handle concrete FindTraceIDs errors.","Keep query windows bounded and service/tag filters consistent so index paths stay well-formed.","When abstracting over backends, map every declared sentinel error in one translation table to avoid gaps."],"tags":["go","badger","legacy","aggregation"],"backgroundTag":"query-aggregation-failed","analyzedSha":"806f4447841ecdb60519f408b004a599d515f437","analyzedAt":"2026-09-01T02:39:22.140Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-08T05:18:18.240Z"}