Re #5294. Throw an exception if no groups are defined.