microsoft/aspire · error

Packed histogram data length must be a multiple of 8 bytes.

Error message

Packed histogram data length must be a multiple of 8 bytes.

What it means

Histogram exemplar or bound values are stored packed as fixed-width 8-byte (long/double) values. ValidatePackedValueLength, called from UnpackUInt64Values and UnpackDoubleValues, throws InvalidOperationException when the byte blob read from storage is not a multiple of sizeof(long), meaning the stored data is truncated or corrupt.

Solutions

  1. Restore telemetry storage from a healthy backup or clear the dashboard telemetry store and let it re-ingest.
  2. Verify the SQLite file integrity (e.g. PRAGMA integrity_check) and fix disk/storage issues.
  3. Ensure the dashboard reading the data matches the version that wrote it.
  4. If reproducible, capture the offending blob length and file an issue.

Example fix

// after detecting the issue, reset storage so corrupt packed blobs are dropped:
// dotnet aspire dashboard --data-dir <new-or-cleared-dir>
// before
var dataDir = "/shared/old-telemetry"; // possibly corrupt
// after
var dataDir = "/home/user/.aspire/dashboard-telemetry"; // fresh store
Defensive patterns

Strategy: try-catch

Try / catch

try
{
    var data = await repo.GetMetricsAsync(query);
}
catch (InvalidOperationException ex) when (ex.Message.Contains("multiple of 8 bytes"))
{
    logger.LogError(ex, "Corrupt packed histogram data; resetting telemetry storage.");
    ResetTelemetryStore();
}

Prevention

When it happens

Trigger: UnpackUInt64Values or UnpackDoubleValues reads a packed histogram value column whose byte length is not a multiple of 8, e.g. during metric reads that unpack exemplar or histogram data.

Common situations: Database rows written by an older/newer schema writing packed data differently; corrupted or truncated SQLite files; manually migrated data where blobs were copied partially.

Understand the failure class

Background: Checksum mismatch errors: "checksum verification failed", "digest mismatch", "expected vs actual checksum" — what they mean and how to fix them — this error's family across 41 libraries.

Related errors


AI-assisted analysis of microsoft/aspire@25830f84bd (2026-09-16). Data as JSON: /api/errors/d1d0c08750ce4199. Report an issue: GitHub.

Appendix: source

Thrown at src/Aspire.Dashboard/Otlp/Storage/SqliteTelemetryRepository.Metrics.Writes.cs:639

        return values;
    }

    private static double[] UnpackDoubleValues(ReadOnlySpan<byte> bytes)
    {
        ValidatePackedValueLength(bytes);
        var values = new double[bytes.Length / sizeof(double)];
        for (var i = 0; i < values.Length; i++)
        {
            values[i] = BitConverter.Int64BitsToDouble(BinaryPrimitives.ReadInt64LittleEndian(bytes[(i * sizeof(double))..]));
        }
        return values;
    }

    private static void ValidatePackedValueLength(ReadOnlySpan<byte> bytes)
    {
        if (bytes.Length % sizeof(long) != 0)
        {
            throw new InvalidOperationException("Packed histogram data length must be a multiple of 8 bytes.");
        }
    }

    private void QueueMetricExemplars(MetricPointBatch pointBatch, long pointId, IEnumerable<Exemplar> exemplars)
    {
        foreach (var exemplar in exemplars)
        {
            if (exemplar.TraceId is null || exemplar.SpanId is null)
            {
                continue;
            }
            var value = exemplar.HasAsDouble ? exemplar.AsDouble : exemplar.AsInt;
            if (!double.IsFinite(value))
            {
                continue;
            }
            var startTicks = OtlpHelpers.UnixNanoSecondsToDateTime(exemplar.TimeUnixNano).Ticks;
            pointBatch.Exemplars.TryAdd(

View on GitHub (pinned to 25830f84bd)