Plan for the worse and make sure it never happens
In order to successfully plan the delivery of your work, you should be prepared for the worse, so that you are not caught out if it happens.
“I didn’t think this would happen” is a weak excuse showing how unprepared you were. There will always be good reasons for not delivering but you were assigned that job because you were trusted to suceed, because people saw you as good enough to handle it. Failing to deliver means they made the wrong decision and it will be hard to come back from that.
Don’t expect the worse to happen, but have a plan in case it does: if you don’t, no one will remember the (valid) problems that got in the way and you will gain a reputation of not being able to deliver.
There are valid reasons for slipping, but not being prepared for the worse isn't one of them. Rise above the rest and become the person known for being a step ahead of everything - and everyone.