on debugging
Debugging is hypothesis testing. You form a theory about what’s wrong, run an experiment to confirm or deny it, update the theory, repeat.
The mistake most people make is running experiments without a theory. Changing things randomly until it works. That’s not debugging, that’s thrashing.
Before you change anything: write down what you think is happening. It forces you to be specific. A vague hypothesis produces a vague experiment.
The other mistake: not reading the error message. The error message is usually telling you exactly what’s wrong. Read it first.