Let us consider a theory defined by an action on a flat space $S[\phi]$ where $\phi$ denotes collectively the fields of the theory. We will study the theory on a general background $g_{\mu\nu}$ and then we will set the metric to be flat. The Euclidean partition function of the theory in the presence of an external source is $$ Z[J] = \int [d\phi] e^{-S -\int d^d x\, J \, \mathcal{O}}\,\qquad (1) $$ where $ \mathcal{O}$ can be either an elementary or a composite field (in what follows we will take it to be the trace of the energy momentum tensor). Now, a very well-known result is that a traceless energy momentum tensor implies conformal invariance; indeed, under a conformal transformation $g_{\mu\nu} \rightarrow f(x)g_{\mu\nu} $ such that $$ \partial_{(\mu}\epsilon_{\nu)} = f(x) g_{\mu\nu} $$ the action transforms like $$ \delta S = \frac{1}{d}\int d^d x T^{\mu}_\mu \partial_\rho \epsilon^\rho $$ Now, another well-known result states that in a generic background metric the expectation value of $T^\mu_\mu$ is not zero but depends on the Weyl-invariant tensors and the Euler density, that is $$ \langle T^\mu_\mu \rangle = \sum a_i E_d - c_i W_{\mu\nu\rho....}^2 $$ where $\langle T^\mu_\mu \rangle$ is usually defined by the variation of the connected vacuum functional $W = \log Z[J]$ under variations of the metric. ***First question.*** Is $\langle T^\mu_\mu \rangle$ calculable in the usual way using the partition function? That is setting $\mathcal{O} = T^\mu_\mu $ in Eq.(1) we compute $$ \langle T^\mu_\mu \rangle = \frac{\delta}{\delta\, J} Z[J]\Big|_{J=0}\,\qquad (2) $$ ***Second question.*** If the answer of the first question is YES, then I would expect the $\langle T^\mu_\mu \rangle$ computed as the variation of the connected vacuum functional $W[J]$ is the same as the one computed in Eq.(2). Is this true? ***Third question.*** The are two ways the classical traceless condition can be realized: 1. **on-shell**; then, $T^{\mu}_\mu$ is not identically zero but it is so once you apply equation of motion,e.g. $\lambda \phi^4$ theory in d=4. 2. $T^\mu_\mu$ is **identically** zero; that is, you don't need to use the equation of motion. In the first case, since $T^\mu_\mu$ vanishes on the equation of motion, I agree that it may receive quantum corrections through the coupling of the theory to a curved space; everything is ok. In the second case instead, namely $T^\mu_\mu$ identically zero, I am unable to compute its expectation value from Eq.(1) and Eq.(2) since $\mathcal{O}=0$ identically; that is, the RHS of Eq.(2) is zero, since Z[J] is actually J-independent. This would imply $\langle T^\mu_\mu \rangle=0$. Is it still true that the theory enjoys an anomaly on curved space background? I would say YES, since the anomaly depends only on the central charges. How to resolve this apparent contraddiction?