Ultrafast infrared spectroscopy shows that in chloroform, beta-lactam is formed immediately after the laser pulse but gamma-lactam is formed from both slow and fast processes. It is concluded that beta-lactam is formed from the diazoamide excited state via the rearrangement in the excited state (RIES) mechanism and that gamma-lactam is formed from both RIES and carbene. In methanol, both carbene decay and the rise of amide ether product are observed directly. Predictions from density functional theory calculations are consistent with these observations.