Acetamide and Nitrous acid Reaction Mechanism

My book says that when acetamide is treated with nitrous acid, ethanoic acid, nitrogen and water are formed but it provides no mechanism. I googled but could not find any mechanism. My guess was that the reaction might start through the protonation of the nitrogen, but after that I got lost. How does this reaction proceed?




Amides can be hydrolysed in acidic and basic medium. Nitrous acid facilitates acidic hydrolysis of amides. The reaction can be written as:


$$\ce{CH3CONH2 + HNO2 -> CH3COOH + N2 + H2O}$$


The main reactive group of the reaction is nitrosonium ion generated from the in-situ reaction of sodium nitrite and hydrochloric acid at 0 °C.


[![enter image description here](https://i.stack.imgur.com/5aEpj.png)](https://i.stack.imgur.com/5aEpj.png)


This nitrosonium ion then attacks the lone pair at nitrogen atoms and forming an intermediate, N-nitrosoamine which undergo proton shift by a sequence analogous to interconversion of a ketone to an enol to form a diazoic acid.


[![enter image description here](https://i.stack.imgur.com/vm7Nu.png)](https://i.stack.imgur.com/vm7Nu.png)


This diazoic acid decompose in acidic medium to diazonium ions:


[![enter image description here](https://i.stack.imgur.com/nlWZR.png)](https://i.stack.imgur.com/nlWZR.png)


Diazonium salts can be regarded as combinations of carbocations $\ce{R+}$ with $\ce{N2}$ and, because of the considerable stability of nitrogen in the form of $\ce{N2}$, it is expected that diazonium salts to decompose readily with evolution of nitrogen and formation of carbocations.


[![enter image description here](https://i.stack.imgur.com/tmQ9L.png)](https://i.stack.imgur.com/tmQ9L.png)


Since our starting reactant was acetamide, the carbocation would be acetyl cation, $\ce{CH3CO+}$ which in fact will react with the water molecules to form acetic acid. Some of the proton generated will drive the reaction forward while some of them will react with hydroxide ion to be the source of water molecules.


$$\ce{CH3CO+ + H2O -> CH3COOH + H+}$$


Secondary amides give N -nitroso compounds with nitrous acid, whereas tertiary amides do not react.


[![enter image description here](https://i.stack.imgur.com/x3qFD.png)](https://i.stack.imgur.com/x3qFD.png)


For reference, I used following chemlibretext articles:


1. <https://chem.libretexts.org/Bookshelves/Organic_Chemistry/Book%3A_Basic_Principles_of_Organic_Chemistry_(Roberts_and_Caserio)/23%3A_Organonitrogen_Compounds_I-_Amines/23.10%3A_Amines_with_Nitrous_Acid>
2. <https://chem.libretexts.org/Bookshelves/Organic_Chemistry/Book%3A_Basic_Principles_of_Organic_Chemistry_(Roberts_and_Caserio)/24%3A_Organonitrogen_Compounds_II-_Amides_Nitriles__Nitro_Compounds/24.04%3A_Hydrolysis_of_Amides>


 10