It’s absolutely unavoidable. Remain focused on the overall goal.
Don’t allow the minor setbacks get to you emotionally. Otherwise you will spend all day bitching, instead of quickly solving the problem and moving on to more important things.
Embrace the chaos of how things can change from day to day, and learn to enjoy solving problems.
Bad events will happen to you. Most of the time it’s you who becomes the biggest obstacle of them all.