jaegertracing/jaeger · error
failed to process bucket: %w
Error message
failed to process bucket: %w
What it means
While iterating buckets of the terms aggregation in grouped mode, each bucket is converted via processOperationBucket. If any individual bucket fails conversion (e.g. its nested date_histogram is missing), toDomainMetrics aborts and wraps the cause as 'failed to process bucket', naming no bucket key — the inner error does.
Source
Thrown at internal/storage/metricstore/elasticsearch/to_domain.go:77
return []*metrics.Metric{
{
Labels: labels,
MetricPoints: toDomainMetricPoints(t.bucketsToPointsFunc(buckets)),
},
}, nil
}
// Handle grouped results when groupByOp is true
agg, found := result.Aggregations.Terms(aggName)
if !found {
return nil, fmt.Errorf("%s aggregation not found", aggName)
}
var metricsData []*metrics.Metric
for _, bucket := range agg.Buckets {
metric, err := t.processOperationBucket(bucket, labels)
if err != nil {
return nil, fmt.Errorf("failed to process bucket: %w", err)
}
metricsData = append(metricsData, metric)
}
return metricsData, nil
}
func buildServiceLabels(serviceNames []string) []*metrics.Label {
labels := make([]*metrics.Label, len(serviceNames))
for i, name := range serviceNames {
labels[i] = &metrics.Label{Name: "service_name", Value: name}
}
return labels
}
func (t *Translator) processOperationBucket(bucket esclient.AggregationBucket, baseLabels []*metrics.Label) (*metrics.Metric, error) {
key := bucket.Key
View on GitHub (pinned to 806f444784)
Solutions
- Inspect the wrapped cause for 'date_histogram aggregation not found in bucket <key>' to find the offending operation.
- Re-run for a time range where all rollup jobs wrote complete buckets.
- Ensure the query always registers the nested date_histogram sub-aggregation under dateHistAggName.
Defensive patterns
Strategy: try-catch
Validate before calling
for _, b := range agg.Buckets {
if _, ok := b["date_histogram"]; !ok {
log.Printf("bucket %v missing date_histogram, skipping", b.Key)
}
} Try / catch
metric, err := t.processOperationBucket(bucket, labels)
if err != nil {
log.Printf("skipping bucket %q: %v", bucket.Key, err)
continue // degrade to partial results instead of failing all
} Prevention
- Ensure every ES rollup job includes the nested date_histogram sub-aggregation.
- Complete cluster upgrades so all buckets share one schema.
- Decide whether partial bucket data should degrade gracefully rather than abort.
When it happens
Trigger: toDomainMetrics with GroupByOperation=true where at least one terms bucket lacks the nested date_histogram sub-aggregation expected by processOperationBucket.
Common situations: Partial aggregation responses from ES (some buckets built by an older job without the sub-agg); mixed-version cluster during upgrade; manually crafted query missing the nested date_histogram.
Related errors
- failed to convert aggregations to metrics: %w
- %s aggregation not found
- date_histogram aggregation not found in bucket %q
- invalid parameters
- could not find aggregation of traceIDs
AI-assisted analysis of jaegertracing/jaeger@806f444784 (2026-09-01).
Data as JSON: /api/errors/1f443a99fa707aaa.
Report an issue: GitHub.