We give a natural obstruction theoretic interpretation to the first Pontryagin class in terms of Courant algebroids. As an application we calculate the class of the stack of algebras of chiral differential operators. In particular, we establish the existence and uniqueness of the chiral de Rham complex.