You must understand why something broke when you fix it
Most bugs are easy enough to understand and fix. Have a look at some logs, reproduce locally, figure out what’s going on and create the fix. (With tests to prevent it happening again of course!) Every now and again you come across a bug that doesn’t seem to make sense. Even if you can reproduce it locally it seems like weird things are happening and you wonder if your computer is haunted…
Sometimes, as part of investigating what’s going, on you make a change that makes the bug go away. If you don’t understand why then don’t just ship the fix. Stop and reason as much as you can about why the change fixed the problem. Ask for someone else to take a look over what you’ve done if you’re still confused. If you don’t figure out what the root cause is then you can’t be sure that your fix isn’t hiding something important that’s wrong.
Strange, hard to debug, problems are usually about the interaction of different parts of the system. Upgrading a library can change some logic that you relied on without knowing about it. Background jobs that interact bring up timing issues that may be rare and hard to reproduce. Maybe your cloud provider updated their linux distro and that’s causing a weird interaction with your language runtime. There are lots of fun ways things can go wrong!
Hopefully you won’t have to go as far as this developer on Reddit…