We develop a proposal by Freed to see anomalous field theories as relative field theories, namely field theories taking value in a field theory in one dimension higher, the anomaly field theory. We show that when the anomaly field theory is extended down to codimension 2, familiar facts about Hamiltonian anomalies can be naturally recovered, such as the fact that the anomalous symmetry group admits only a projective representation on the Hilbert space, or that the latter is really an abelian bundle gerbe over the moduli space. We include in the discussion the case of non-invertible anomaly field theories, which is relevant to six-dimensional (2, 0) superconformal theories. In this case, we show that the Hamiltonian anomaly is characterized by a degree 2 non-abelian group cohomology class, associated to the non-abelian gerbe playing the role of the state space of the anomalous theory. We construct Dai-Freed theories, governing the anomalies of chiral fermionic theories, and Wess-Zumino theories, governing the anomalies of Wess-Zumino terms and self-dual field theories, as extended field theories down to codimension 2.