A visible light-promoted generation of nitrilium ions from diazoacetates and nitriles has been developed. The reaction utilized visible light transformation of diazoacetates to the free carbene that could be trapped by nitriles to generate nitrilium ions, followed by nucleophilic attack on the benzotriazoles and carboxylic acids. This protocol provides an efficient and practical approach to N-imidoylbenzotriazoles and diacylglycine esters in good to excellent yields.