It's not random at all, it's 100% reproduceable. Make sure you are not in a city or inn and start logging off, while the StaticPopup is shown letting you cancel the logout process, cancel it.
AceComm-2.0 prehooks CancelLogout() due to its outdated chat channel handling code. It CAN NOT be fixed without rewriting the entirety of the AceComm-2.0 chat channel handling. The only option is to leave it as is or remove the hook so it doesn't error and instead allow people to cancel the logout but possibly break the state of AceComm-2.0 until they do relog or reload.
Sort answer, stop using addons that use AceComm-2.0.