Describe the bug
aggregate_arrayrecords and aggregate_metricrecords in framework/py/flwr/serverapp/strategy/strategy_utils.py divide by the summed weighting metric with no zero guard:
total_weight = sum(weights)
weight_factors = [w / total_weight for w in weights] # ZeroDivisionError when total_weight == 0
If every reply reports 0 for the weighting metric (default num-examples) — e.g. a round where each client's local partition is empty after filtering — total_weight is 0.0 and this raises ZeroDivisionError, crashing aggregate_train/aggregate_evaluate in the ServerApp.
validate_message_reply_consistency only checks the weighting key exists and isn't a list; it never checks the sum. These two functions are the default aggregators for FedAvg and every subclass (FedProx, FedAdam, FedMedian, Krum, FedTrimmedAvg, …), so it affects the whole strategy family.
This is the same class as #7645/#7646, but in the new Message-API module (serverapp/strategy/strategy_utils.py), which those PRs don't touch.
Steps to reproduce
Aggregate a round where every reply's weighting metric is 0 → ZeroDivisionError: float division by zero.
Expected behavior
Raise a clear InconsistentMessageReplies explaining the total is zero, consistent with the other checks in this module.
Fix + regression test ready; will open a PR.
Describe the bug
aggregate_arrayrecordsandaggregate_metricrecordsinframework/py/flwr/serverapp/strategy/strategy_utils.pydivide by the summed weighting metric with no zero guard:If every reply reports
0for the weighting metric (defaultnum-examples) — e.g. a round where each client's local partition is empty after filtering —total_weightis0.0and this raisesZeroDivisionError, crashingaggregate_train/aggregate_evaluatein the ServerApp.validate_message_reply_consistencyonly checks the weighting key exists and isn't a list; it never checks the sum. These two functions are the default aggregators forFedAvgand every subclass (FedProx, FedAdam, FedMedian, Krum, FedTrimmedAvg, …), so it affects the whole strategy family.This is the same class as #7645/#7646, but in the new Message-API module (
serverapp/strategy/strategy_utils.py), which those PRs don't touch.Steps to reproduce
Aggregate a round where every reply's weighting metric is
0→ZeroDivisionError: float division by zero.Expected behavior
Raise a clear
InconsistentMessageRepliesexplaining the total is zero, consistent with the other checks in this module.Fix + regression test ready; will open a PR.