Learn How To Deal With Gumption Traps
I first heard the term "gumption trap" in the book Zen and the Art of Motorcycle Maintenance (which is only superficially about motorcycle maintenance). The author talks about reassembling a bike only to realize that you've left a part out and how your energy is just drained knowing you'll have to redo everything.
Gumption traps are those little demoralizing problems that stand in the way of your actual goal; the one person who can answer your question is current on vacation, your dev environment is messed up in some way, CI is broken. Things like this can completely sap the momentum you have when trying to solve problems. Sometimes gumption traps come in the form of "hang ups", personal views that can stand in your way; "this is a stupid language to build this in", "I should be smart enough to figure this out quickly", "If this legacy code wasn't such a mess, this would be easy".
So how do you prevent these things from completely derailing your work? The simple answer is to build more gumption, but it's not an easy answer. Sometimes you'll need to step away from a problem for a bit and regain perspective. Sometimes you'll need work to come to peace with things about your system (or yourself) that just can't be changed right now. Sometimes you'll just need to focus on the big picture and recognize that all these annoying stumbling blocks are just part of getting non-trivial work done.
Honestly, there's no easy solution to gumption traps, but being aware of them can help and building gumption is one of the most useful things you can do as a developer.