I recently had the thought, "A botched plot never boils."
It can happen to any writer. You have your setting, and your characters, and your mood/theme/soapbox. You have a plot arc, nice and neat, with interesting twists and character development along the way to the lovely, satisfying conclusion. You already have ideas for the sequel.
And then something throws you a curve ball.
Maybe one of your characters took it into his head to do something unplanned. Maybe what you had in mind didn't ring true to the motivations of the character. Maybe you got a better idea in the middle of writing the piece and brought in a new thread that suddenly dangled in front of your face, asking none too politely What are you going to do with me?
What happens when a writer writes himself into a corner?
The short answer is: profanity.
The longer answer is: re-writing. Sometimes you just have to give up on some words, cut them out with regret, and start over. It's often painful, but sometimes the original idea was the better one, and this Brilliant New Idea that crammed itself into your eyeballs was a red herring.
There's a Mexican folk saying, No plan works out perfectly, but every plan works out. Once you take out the artificial need for perfection, for exact adherence to the original plan simply because it was the original, the writer is freed to pursue something more rare and evanescent in their writing than a dry, sterile plot arc or fever chart. The intangible, the unplanned is unpredictable and you cannot count on it - but if you embrace it, you can turn profanity into la découverte joyeuse - the happy accident.