Ammonia and amines are good nucleophiles. When nucleophilic acyl substitution is carried out with an amine as the nucleophile, the product of the reaction is an amide, one of the most stable types of carboxylic acid derivatives. Aminolysis of carboxylic acid derivatives is widely used, especially in the synthesis of peptides.
If one tried to carry out aminolysis of a carboxylic acid, an ammonium carboxylate salt would be formed instead. Only proton exchange would occur, not acyl substitution. To overcome this, the carboxylic acid would first need to be converted into another carboxylic acid derivative such as an ester, anhydride, or acid halide and then aminolysis carried out.
In the aminolysis of an ester, as in the figure above, alkoxide anion handles removing the proton in the deprotonation step. However, when aminolysis is carried out upon a compound such as acid anhydride or acid halide, there is nothing to prevent the proton lost in the deprotonation step from being taken up by another amine nucleophile, rendering it useless as a nucleophile. For this reason, two equivalents of amine must be used in some aminolysis reactions.