Hello there,
Please add some additional information like when and where are you getting this log?
According to the error 8240, it is most likely that there is an issue at AD Replication.
Please to check replication status among domain by running Repadmin /repsum.
Have you tried running with setup.exe /prepareAD /Domaincontroller:<FQDN> /IacceptExchangeServerlicenseterms?
Also, you can mount the exchange server iso in domain controller and run the setup.exe /prepareAD /IacceptExchangeServerlicenseterms
The below thread discusses the same issue and you can try out some troubleshooting steps from this and see if that helps you to sort the Issue.
-----------------------------------------------------------------------------------------------------------------------------------------------------
--If the reply is helpful, please Upvote and Accept it as an answer--