explicitly to holomorphic anomalies of noncompact SQFTs, and thereby to mock modularity, which is of great current interest due to the “moonshine” of [@MR2802725; @MR3271175].

Whenever the CFT ${\mathcal B}$ is rational, the source of the holomorphic anomaly equation is a modular-invariant bilinear combination of vector-valued holomorphic and anti-holomorphic modular forms. The corresponding generalized mock modular form is then a “mixed mock modular form”: a bilinear combination of the same vector-valued holomorphic modular form and a true vector-valued mock modular form. In such a situation, our arguments can be seen as a justification for the very existence of mock modular forms with interesting integrality properties.

The paper is structured as follows.

Section \[sec.general\] presents the general story. We first make some brief remarks about gravitational anomalies, and a $\eta(\tau)^n$ normalization factor that we include in the elliptic genus[^4] and in one-point functions in order to correct the multipliers that would otherwise be present. We then discuss the properties of certain SQFTs which violate the compactness constraint in a controllable manner. It turns out to be still possible to define the elliptic genus of such SQFTs [@Eguchi:2006tu; @MR2821103; @Ashok:2013pya; @Gupta:2017bcp]. Such elliptic genus satisfies a “holomorphic anomaly” equation with a source 