What is the relationship between these two sorts of anomalies? Recently there has been a few questions about anomalies in QFTs:
Why do some anomalies (only) lead to inconsistent quantum field theories
Classical and quantum anomalies
In these, people have been discussing anomalies that (let me know if I am wrong in my understanding here) come from essential symmetries which cannot be realised by finite energy unitary representations on a suitable Hilbert space.
Meanwhile, my understanding of "anomaly cancellation formulas" that appear for instance in 11d supergravity is that, a priori the action functional is not an honest function on the configuration space of the theory, but a section of a line bundle over the config space. Nontriviality of the line bundle prevents integration of the action functional. This is my definition of an anomaly. Anomaly cancellation happens for example when the bosonic and fermionic sectors have action functionals in dual line bundles, so that in the tensor product theory there is no anomaly, though either sector is by itself anomalous.
My question is: what is the relationship (if any) between these two perspectives?
I suspect there is some on the basis of the Borel-Weil-Bott theorem, but this is idle speculation.
 A: In the case of an ungauged symmetry, the product of the exponents of the action functional corresponding of all sectors of the theory needs not to be a scalar, i.e., there can be still a net anomaly as far as its symmetry is not gauged.
In this case, the exponent of the action functional will be a section of a line bundle, and the wave function(als) themselves will be sections of the dual line bundle, thus we obtain a scalar only when the action functional is sandwiched between two wave functions (giving  a
transition amplitude). The most famous action functional is obtained in
this manner is the case chiral anomaly. The integration over the fermionic fields produces the Dirac determinant line bundle, please see the following lecture by:Juoko Mickelsson. Please see also the following work by: Orlando Alvarez giving examples that in this case the coefficients of certain terms in the Lagrangian need to be quantized.
Positive energy unitary highest weight representations of anomalous current algebras exist in $1+1$ dimensions, and in this case the anomaly is essential to obtain nontrivial representations. Representations of this kind were obtained in Pressley and Segal: Loop groups. No generalizations to realistic theories in $3+1$ dimensions are known. Juoko Mickelsson was able to construct a representation on a Hilbert bundle.
The connection with the Borel-Weil theorem is that in the finite
dimensional case, the tautological line bundle of the complex
Grassmannian $Gr(k,n)$ (Please see: Stefan Berceanu’s article)
is a determinant line bundle of the k dimensional subspaces of an n-dimensional complex vector space, associated with a antisymmetric representation corresponding (according to the Borel-Weil theorem) to the $k$-box column Young tableaux. This connection extends to the case of loop groups, but again, no generalization for groups of mapping to higher dimensional manifolds (such as three dimensional) are known.
