diff --git a/src/dbnode/storage/repair/types.go b/src/dbnode/storage/repair/types.go index 49045f974d..30e8d416eb 100644 --- a/src/dbnode/storage/repair/types.go +++ b/src/dbnode/storage/repair/types.go @@ -298,6 +298,10 @@ func (r PeerMetadataComparisonResults) Aggregate() AggregatePeerMetadataComparis result.ComparedMissingBlocks += elem.ComparedMissingBlocks result.ComparedExtraBlocks += elem.ComparedExtraBlocks } + if result.ComparedBlocks > 0 { + // Do not divide by zero and end up with a struct that cannot be JSON serialized. + return result + } result.ComparedDifferingPercent = float64(result.ComparedDifferingBlocks) / float64(result.ComparedBlocks) return result }