The formation mechanism of perovskite methylammonium lead triiodide (CH3NH3PbI3) was studied with in situ X-ray photoelectron spectroscopy (XPS) on successive depositions of thermally evaporated methylammonium iodide (CH3NH3I) on a lead iodide (PbI2) film. This deposition method mimics the “two-step” synthesis method commonly used in device fabrication. We find that several competing processes occur during the formation of perovskite CH3NH3PbI3. Our most important finding is that during vapour deposition of CH3NH3I onto PbI2, at least two carbon species are present in the resulting material, while only one nitrogen species is present. This suggests that CH3NH3I can dissociate during the transition to a perovskite phase, and some of the resulting molecules can be incorporated into the perovskite. The effect of partial CH3NH3 substitution with CH3 was evaluated, and electronic structure calculations show that CH3 defects would impact the photovoltaic performance in perovskite solar cells. The possibility that not all A sites in the APbI3 perovskite are occupied by CH3NH3 is therefore an important consideration when evaluating the performance of organometallic trihalide solar cells synthesized using typical approaches.