microsoft/aspire · error · InvalidOperationException
Histogram data point has bucket counts without any explicit…
Error message
Histogram data point has bucket counts without any explicit bounds.
What it means
Aspire Dashboard validates incoming OTLP histogram data points. A histogram that reports bucket counts must also declare the explicit bounds that define those buckets; otherwise the bucket boundaries are unknowable and the data cannot be rendered as a histogram. The library throws this InvalidOperationException during data-point validation to reject malformed/inconsistent histogram telemetry before it is stored.
Solutions
- Fix the telemetry producer so every HistogramDataPoint with bucket_counts also carries a matching explicit_bounds list (bounds.Count should equal bucketCounts.Count - 1 per OTLP spec).
- Check the emitting SDK/collector configuration and upgrade to a version that populates explicit bounds for explicit-bucket histograms.
- If the data source is out of your control, intercept it upstream (e.g. a collector transform/filter processor) to drop or repair such histogram points before they reach the Dashboard.
Example fix
// before: manual HistogramDataPoint without bounds
var point = new HistogramDataPoint { BucketCounts = { 1, 2, 3 } };
// after: bounds must define every bucket boundary (n-1 boundaries for n buckets)
var point = new HistogramDataPoint
{
BucketCounts = { 1, 2, 3 },
ExplicitBounds = { 10.0, 100.0 }
}; Defensive patterns
Strategy: validation
Validate before calling
// before sending/accepting a histogram data point bool valid = point.BucketCounts.Count == 0 || point.ExplicitBounds.Count > 0;
Try / catch
try
{
repository.AddMetrics(request);
}
catch (InvalidOperationException ex) when (ex.Message.Contains("bucket counts without any explicit bounds"))
{
logger.LogWarning(ex, "Dropping histogram data point with buckets but no explicit bounds.");
} Prevention
- Always populate ExplicitBounds when populating BucketCounts (bounds.Count == bucketCounts.Count - 1).
- Use a maintained OpenTelemetry SDK rather than hand-building HistogramDataPoint protobufs.
- Add a unit test asserting exporter output histograms include bounds.
When it happens
Trigger: ValidateHistogramDataPoint is called while importing an OTLP ExportMetricsServiceRequest; it throws when point.BucketCounts.Count > 0 while point.ExplicitBounds.Count == 0. In practice: an SDK or collector forwards histogram metrics with bucket_counts populated but explicit_bounds omitted in the HistogramDataPoint protobuf.
Common situations: Hand-rolled OTLP exporters or test harnesses that construct HistogramDataPoint manually and fill bucket_counts without bounds; metric-producing libraries with broken/legacy histogram emission; protobuf messages built by third-party tools that misencode the histogram fields.
Understand the failure class
Background: Schema validation failed / invalid input schema: payload rejected because its shape doesn't match the expected schema — this error's family across 28 libraries.
Related errors
- Histogram data point sum must be finite.
- Metric data point value must be finite.
- Circular loop detected for span
- Dimension limit of reached.
- Duplicate span id ' ' detected.
AI-assisted analysis of microsoft/aspire@25830f84bd (2026-09-16).
Data as JSON: /api/errors/b281de3bbc9f87f4.
Report an issue: GitHub.
Appendix: source
Thrown at src/Aspire.Dashboard/Otlp/Model/OtlpHelpers.cs:68
Metric.DataOneofCase.Gauge => metric.Gauge.DataPoints.Count,
Metric.DataOneofCase.Sum => metric.Sum.DataPoints.Count,
Metric.DataOneofCase.Histogram => metric.Histogram.DataPoints.Count,
Metric.DataOneofCase.Summary => metric.Summary.DataPoints.Count,
Metric.DataOneofCase.ExponentialHistogram => metric.ExponentialHistogram.DataPoints.Count,
_ => 0,
};
}
internal static void ValidateHistogramDataPoint(HistogramDataPoint point)
{
if (!double.IsFinite(point.Sum))
{
throw new InvalidOperationException("Histogram data point sum must be finite.");
}
if (point.BucketCounts.Count > 0 && point.ExplicitBounds.Count == 0)
{
throw new InvalidOperationException("Histogram data point has bucket counts without any explicit bounds.");
}
}
internal static void ValidateNumberDataPoint(NumberDataPoint point)
{
if (point.ValueCase == NumberDataPoint.ValueOneofCase.AsDouble && !double.IsFinite(point.AsDouble))
{
throw new InvalidOperationException("Metric data point value must be finite.");
}
}
public static ResourceKey GetResourceKey(this Resource resource)
{
string? serviceName = null;
string? serviceInstanceId = null;
string? processExecutableName = null;
for (var i = 0; i < resource.Attributes.Count; i++)View on GitHub (pinned to 25830f84bd)