If you’ve truly exhausted every avenue available to you and you must cancel, then the first thing you have to do is communicate this to your registered attendees/sponsors and stop accepting new ones. It’s impossible to give a strict timeline for how far in advance of an event’s date that you should tell everyone, but it should be as soon as you’ve made the final decision because procrastinating about it won’t make it anyone easier for you or your audience. Ideally, this should be at least a full 24 hours before the event, and longer if there might be people traveling long distances to attend.