Merge "Catch exceptions when grouping sparse groups" into main