The obstacles I'm talking about are the ones you hit when you are doing an edit.
You find something that couldn't happen or that contradicts something you later rely on...
What on earth do you do? Of course, editing uncovers other more manageable and minor problems - issues around name, place, time; jarring sentences, repetition. (by the way nothing beats beta readers or professional editors for helping with this, ironing out the wrinkles and also making you better at spotting similar things in later books).
But, what about the much bigger mistake - the one that makes a nonsense of your plot or will either make the reader fling the book away in disgust or fail before it even gets to a reader?
The first feeling of blind panic and self-loathing is just something you have to get through. Then, it really is not as bad as it seems. I have hit major problems like this. Go away and go for a walk or do something different for a while. Then, deep breath and glue your backside to the chair and your eyes to the screen. The sorting out will not be as bad as you first thought.
In the funny way of things, in my mentoring job at my local uni, this experience helps me to help students calm down when this sort of thing happens with their assignments. This is particularly pertinent at this time of the year when all their work is due in very soon.