I’m mentoring two new programmers, and remembering what it’s like to learn programming. You follow a tutorial, you write some code, you run it just like they tell you to…and you’re hit with a long error message full of words you don’t understand like Manager object and module.
It’s too daunting to read, so you copy the message into Google, then copy the first response from Stack Overflow. The original error message goes away but now there’s a new error message in its place. Did you solve the original error, or did you just mess things up even further? It’s unclear.
Here’s my advice for new programmers on how to read error messages:
- Go slower. When you get an error message, read the error message. Then try to understand the message, which might involve re-reading it 5 more times.
- If you have a super long error message, you can skim or skip the middle part. The last or second-to-last line of the error message usually has a one sentence description of the error. Early in the error message, you might see a traceback that points you to the exact line in your code that’s failing — that’s helpful too, look for that.
- Do not just copy and paste the entire error into Google by default. The problem with copy-pasting an error into Google is that you won’t learn anything. If you want to get good at programming, you need to learn how to parse error messages. If you rely on blind copy-pasta forever, you’ll always be just as lost as you are right now. Instead, make a guess as to why the error occurred. Google is still your friend, but instead of googling the exact error message, make searches based on your understanding of the error.
please do not confuse your cursory google search with my somewhat longer and more thought out series of google searches— sucks (@powerbottomdad1) May 27, 2021
- It’s totally normal to run into 10 error messages in a row. That’s just programming — it’s frustrating, but it’s why programmers are paid so well. Even when you have more experience, you’ll run into this. Regularly! So no need to get anxious if you run into one error message after another.
- You MUST use a notebook while you code. If you follow an error rabbit hole for 10 errors, you’ll probably forget what you were trying to do in the first place, when you finally resolve them all. So it’s helpful to write down what you’re working on, so you can remind yourself of the big picture when you emerge from Error Hell.
- Read the error message. Actually. Read it.
- Okay, you don’t have to read the whole thing if it’s long. But read the beginning and the end, carefully, until it starts to make sense.
- Use your newfound understanding of the error to write a more useful search query than simply copy and pasting the error text.
- You’re gonna see a lot of error messages, kid. Don’t stress.
- Use a notebook or you’ll get lost.