Reading Error Messages Like a Developer
- ShiftQuality Contributor
- Nov 25, 2025
- 5 min read
The first time you see a stack trace — 40 lines of file paths, line numbers, and cryptic function names — your brain says "something is very wrong." Your instinct is to copy the whole thing into Google and hope someone on Stack Overflow has the answer.
Sometimes that works. But it's the software equivalent of taking a photo of your car's dashboard warning light and sending it to a mechanic instead of reading what the light says. Most error messages tell you exactly what went wrong and where. The skill isn't finding someone else's answer — it's reading the answer your computer already gave you.
The Anatomy of an Error Message
Every error message, in every language, has the same basic structure:
What happened — the type of error
Why it happened — a description
Where it happened — file name and line number
TypeError: Cannot read properties of undefined (reading 'email')
at getUser (/app/src/users.js:15:22)
at processRequest (/app/src/server.js:42:10)
What: TypeError — you tried to use something that doesn't exist the way you expected.
Why: Cannot read properties of undefined (reading 'email') — you tried to access .email on something that's undefined. The variable you expected to hold an object doesn't.
Where: /app/src/users.js:15:22 — file users.js, line 15, column 22. That's where the bug is. Open that file, go to that line, and look at what's trying to access .email.
That's it. Three pieces of information. The error told you everything you need to start fixing the problem.
Reading Stack Traces
A stack trace shows the chain of function calls that led to the error. Read it top-to-bottom — the top is where the error occurred, and each line below it is what called that function.
Traceback (most recent call last):
File "app.py", line 45, in handle_request
result = process_order(order)
File "orders.py", line 23, in process_order
total = calculate_total(order.items)
File "pricing.py", line 12, in calculate_total
price = item.price * item.quantity
AttributeError: 'NoneType' object has no attribute 'price'
Read from the bottom:
The error: One of the items is None, and you tried to access .price on it
Where: pricing.py, line 12
Called from: orders.py, line 23 (calculate_total(order.items))
Called from: app.py, line 45 (process_order(order))
The fix is usually at the top of the trace (where the error occurred) or one level below (where the bad data was passed). In this case, either pricing.py needs to handle None items, or orders.py is passing a list that contains None entries.
Your Code vs. Framework Code
Stack traces mix your code with framework and library code. Don't read the framework lines — scan for your files.
File "/usr/lib/python3.11/site-packages/flask/app.py", line 1498 ← framework, skip
File "/usr/lib/python3.11/site-packages/flask/app.py", line 1476 ← framework, skip
File "app.py", line 45, in handle_request ← YOUR CODE
File "orders.py", line 23, in process_order ← YOUR CODE
File "pricing.py", line 12, in calculate_total ← YOUR CODE
The bug is in your code, not in Flask. Start investigating at the topmost line that's in your code.
The Most Common Error Types
Null / Undefined / NoneType Errors
The single most common error in programming. You tried to use something that doesn't exist.
TypeError: Cannot read properties of undefined
NullReferenceException
AttributeError: 'NoneType' object has no attribute 'name'
Translation: A variable you expected to have a value is empty. Check: where does this variable get its value? Did the function that was supposed to return data return null instead? Did the database query find no results?
Syntax Errors
You wrote something the language can't parse.
SyntaxError: Unexpected token '}'
SyntaxError: invalid syntax
Translation: There's a typo or structural error. Missing bracket, extra comma, misspelled keyword. The line number points to where the parser got confused, which is sometimes the line after the actual mistake (the parser didn't realize something was wrong until it tried to parse the next line).
Import / Module Not Found
The code references something that doesn't exist or can't be found.
ModuleNotFoundError: No module named 'requests'
Cannot find module './components/Header'
Translation: Either the package isn't installed (pip install requests), the file doesn't exist at that path, or there's a typo in the import path. Check spelling first. Check installation second.
Type Errors
You used a value in a way that doesn't match its type.
TypeError: unsupported operand type(s) for +: 'int' and 'str'
Translation: You tried to add a number and a string. One of your variables isn't the type you expected. Check where the variable gets its value — something is returning a string when you expected a number, or vice versa.
Permission Errors
You don't have access to do what you're trying to do.
PermissionError: [Errno 13] Permission denied
EACCES: permission denied
Translation: The operating system won't let you read/write that file or access that port. Either the file permissions are wrong, you need to run with elevated privileges, or another process is using the resource.
The Process
When you see an error:
Read the last line first. That's the error type and description. Understand what it says before looking at anything else.
Find your code in the stack trace. Skip framework lines. Look for your file names and line numbers.
Go to the line. Open the file, navigate to the line number. Read the code on that line. What operation is it performing? What values is it working with?
Ask: what did I expect vs. what happened? You expected user to be an object. It's undefined. You expected items to be a list. It's None. The gap between expectation and reality is the bug.
Trace backward. Where did the bad value come from? What function returned it? What condition led to it being empty/wrong/missing?
Then Google if needed. If you still don't understand the error after reading it and checking the code, search for the error message. But now you're searching with context — you know what the error means and where it occurs. You'll find the right answer faster.
The Mindset Shift
Beginners treat error messages as obstacles — red text that means something bad happened. Experienced developers treat them as information — diagnostic output that tells you exactly where to look.
The error message is not the problem. It's the map to the problem. The more carefully you read it, the faster you find and fix the bug.
The developer who reads the error message carefully and goes to line 15 of users.js fixes the bug in 5 minutes. The developer who copies the entire stack trace into Google spends 20 minutes finding a Stack Overflow answer that might not apply to their situation. Both fix the bug eventually. One of them is four times faster.
Key Takeaway
Error messages have three parts: what happened (error type), why (description), and where (file and line number). Read from the bottom of the stack trace for the error, scan for your files to find the location, go to that line, and ask what you expected versus what happened. The five most common errors — null references, syntax errors, import failures, type mismatches, and permission issues — each have a predictable fix pattern. Read the error first. Google second.



Comments