  We consider a class of lattice topological field theories, among which are
the weak-coupling limit of 2d Yang-Mills theory and 3d Riemannian quantum
gravity, whose dynamical variables are flat discrete connections with compact
structure group on a cell 2-complex. In these models, it is known that the path
integral measure is ill-defined because of a phenomenon known as `bubble
divergences'. In this paper, we extend recent results of the authors to the
cases where these divergences cannot be understood in terms of cellular
cohomology. We introduce in its place the relevant {\it twisted} cohomology,
and use it to compute the divergence degree of the partition function. We also
relate its dominant part to the Reidemeister torsion of the complex, thereby
generalizing previous results of Barrett and Naish-Guzman. The main limitation
to our approach is the presence of singularities in the representation variety
of the fundamental group of the complex; we illustrate this issue in the
well-known case of two-dimensional manifolds.
