An efficient and convenient method has been described for the selective conversion of an ester group into the corresponding carboxamide in vinylogous ester–aldehydes of imidazole. The method uses excess guanidine, which protects the aldehyde function as a diaminodihydro-s-triazine moiety. The carboxaldehyde group is regenerated by hydrolysis of the triazine moiety to provide vinylogous amide–aldehydes of imidazole as the final product.