We count quaternionic automorphic representations on the exceptional group G2 by developing a G2 version of the classical Eichler-Selberg trace formula for holomorphic modular forms.
There are three main technical points. First, quaternionic discrete series come in L-packets with non-quaternionic members and standard invariant trace formula techniques cannot easily distinguish between discrete series with real component in the same L-packet. Using the more modern stable trace formula resolves this issue. Second, quaternionic discrete series do not satisfy a technical condition of being "regular", so the trace formula can a priori pick up unwanted contributions from automorphic representations with non-tempered components at infinity---some work with real representation theory is required. Finally, we apply some tricks of Chenevier, Renard, and Taïbi for the level-1 case to avoid onerous computations on the geometric side.