When I tried to uninstall the old exchange server 2013 from an environment the process failed with below error.

Solution:
Using the Exchange 2013 setup file open command prompt as administrator and run the following command:
Setup.exe /mode:Uninstall /IAcceptExchangeServerLicenseTerms
After removing server roles and files Exchange server 2013 completely uninstalled from the server.