When you write code, you have a local development environment you're able to work on. This gives you a real-time look at what your code does and how it functions. Once you get it working as you wish in development, then you push it to production, which allows others to visit a URL and actually view it.
The development environment is as close to the production environment as it can get, but there are still flaws. You can solve for a lot of the errors before you push it to production, but sometimes while you're trying to push it to production, you get errors. This is infuriating.
"It works perfectly in development, why isn't working in production?!"
The worst part of this experience is the error message the production logs give are usually vague and not very helpful. Most of the time it's something along the lines of, 'Hey this page had an error. May the odds be ever in your favor."
Life is the same way.
You can prepare for a situation as much as you want, but practicing and being in the situation in real-life will never be the same thing. There are too many outside variables in real life affecting your environment. Sometimes, you're forced to solve the vague errors on the spot.