The CohenLenstra paper says the probability that the odd part of a class group being cyclic is close to 0.98. So I was thinking: can we find any conditions on a finite abelian group so that it cannot be a class group of any number field?

1$\begingroup$ related discussion math.stackexchange.com/questions/10949/… $\endgroup$ – Matthias Wendt Jul 16 at 17:23

$\begingroup$ @YCor I'd think "old part" probably should be "odd part"... $\endgroup$ – paul garrett Jul 16 at 18:43

2$\begingroup$ Actually, the passage from CohenLenstra that the question refers to concerns class groups of imaginary quadratic fields. The paper makes no statements about the statistics of class groups of all number fields. $\endgroup$ – Alex B. Jul 16 at 20:04
It follows from the CohenLenstra heuristic that every finite abelian group is isomorphic to infinitely many class groups of real quadratic fields (even to a positive proportion of real quadratics, which is stronger), but nothing like this is known.
However, if you take the Galois action into account, then things get interesting: there are Galois modules that are not isomorphic to any class group of a Galois number field with the respective Galois group. See Corollary 4.8 and the bottom of page 17 in this paper of mine with Lenstra: https://arxiv.org/abs/1803.06903v2. You have to read a bit between the lines, but it is shown there that if $G$ is a cyclic group of order degree $58$, then there are finite $\mathbb{Q}[G]$modules that cannot be realised as the class group of a $G$extension (the "almost all" in the last line of page 17 can be strengthened to "all but one, namely the one for the field $\mathbb{Q}_{\zeta_{59}}$").
Of course, there are cheap ways of doing that, by demanding that the fixed submodule is something silly, contradicting the fact that the class group of $\mathbb{Q}$ is trivial, but that is not what is happening in our paper. For example our obstruction cannot be seen by looking at any particular $p$Sylow of the class group.