Vibe coding · Debugging basics · For beginners
How to Read Error Messages When You Can’t Code
The red wall of text isn’t yelling at you. It’s pointing.
Three questions, six real errors, and the one line you can safely ignore.
You asked the AI for one new feature. You run the app. And there it is: forty lines of red text, half of it paths you have never seen, ending in a word like TypeError that sounds like a diagnosis.
So you do what almost everyone does. You select everything, paste it into the chat, and type “fix”. Sometimes that works. Sometimes the AI changes four files and the error turns into a different error, and now you have no idea what you are even looking at.
Good news — you do not need to understand the code to read the message. An error message is a short report with three parts, and you only need to find them. If the app was already working and you just want it back, start with how to go back with git first, then come back here.
The short version
To read an error, ask three questions: what happened (the error name and message), where it crashed (the first line pointing at your own file), and who called it (the lines around it). In Node, start at the top; in Python, start at the bottom. The crash line shows where the program fell, not always where the mistake is.
⚠️ What this post is, and isn’t
I triggered six errors on purpose in tiny test files on Nov 11, 2026 (Node v22.23.4 and Python 3.13.18, Linux sandbox) and copied the real output. File paths are shortened. This is a how-to, not a diary of a real disaster. I have not tested any of this inside Cursor, Claude Code or a browser console. The Python reading rules are checked against the official Python docs; the Node explanations come from my own runs.
The three questions that decode any error
Every error I triggered answered the same three questions. Ask them in this order:
1. What happened?
This is the error name and message, like ReferenceError: itmes is not defined. The name (ReferenceError, TypeError, SyntaxError) is the category. The message is the detail. MDN keeps a reference of JavaScript error messages if you want the official wording for any of them.
2. Where did it crash?
Look for the first line that points at a file you or the AI wrote, something like cart.js:2:16. That means file, line 2, column 16. Lines that mention node:internal or a folder called node_modules belong to Node and your installed packages, not to your code.
3. Who called it?
The lines around the crash show the chain of calls that led there. This is where the real mistake usually hides, and it is the part most beginners never read.
One more thing before the examples: the two languages print errors in opposite order.
| Node.js (JavaScript) | Python | |
|---|---|---|
| Where is “what happened”? | On the line that starts with the error name, near the top | The very last line |
| How do you read the call chain? | Top to bottom: first at line is the crash, the next ones are its callers | Bottom to top: the frame just above the last line is the crash |
| Official note | Not checked against Node docs (I could not read that section); based on my runs | Python docs: “The last line of the error message indicates what happened.” |
Example 1: the crash that blamed the wrong line
Here is a tiny file in the style of something an AI might write. It prints a receipt for a user:
function getTotal(order) {
return order.items.reduce((sum, i) => sum + i.price * i.qty, 0);
}
function showReceipt(user) {
const total = getTotal(user.order);
console.log(user.name + " owes " + total);
}
showReceipt({ name: "Mina" });Running node cart.js printed this (I trimmed the Node-internal lines and shortened the paths):
cart.js:2
return order.items.reduce((sum, i) => sum + i.price * i.qty, 0);
^
TypeError: Cannot read properties of undefined (reading 'items')
at getTotal (cart.js:2:16)
at showReceipt (cart.js:5:17)
at Object.<anonymous> (cart.js:8:1)
... (7 node:internal lines)Question 1: something called undefined was asked for its items. Question 2: line 2. But line 2 looks perfectly fine. Question 3 is the one that solves it: getTotal was called by showReceipt on line 5, which was called on line 8 with { name: "Mina" } and no order at all. The line in the error is where the program fell over, not necessarily where the mistake was made.
Which line is actually the problem? (syntax errors)
Syntax errors are the cases where the language cannot even read the file, and they are the most misleading of all. Two real ones:
$ python3 loop.py
File "loop.py", line 1
while True print("Hello")
^^^^^
SyntaxError: invalid syntaxPython points at print. The mistake is the missing colon just before it. The Python docs describe exactly this: the error is reported where it was detected, and the real fix can be right before that spot (see the Python tutorial on errors).
$ node broken.js
broken.js:5
SyntaxError: Unexpected end of inputMy file had a function with a missing closing } on line 3, but Node reported line 5, the end of the file, and showed nothing under it. For syntax errors, read the line the error names and the lines just above it. A missing bracket is an easy slip whenever code is edited in the middle of a file.
The error that is not a code bug — and the easy fix
Error: Cannot find module 'express'
Require stack:
- app.js
... {
code: 'MODULE_NOT_FOUND', ... }This one looks scary — and it is the friendliest of the six. The code was fine; the package it imports was simply not installed on that machine. I ran npm install express in the same folder, ran node app.js again, and it printed started. If an AI hands you code that imports something new, this is an error you may well meet.
💡 Test the fix the right way
After the AI fixes something, run the same command that failed. If the error is gone, you are done. If a different error appears, you made progress: read the new one with the same three questions.
A Python traceback, read from the bottom up
Traceback (most recent call last):
File "app.py", line 7, in <module>
print(checkout([{"price": 5}, {"cost": 7}]))
File "app.py", line 5, in checkout
return sum(load_price(item) for item in cart)
File "app.py", line 2, in load_price
return data["price"]
KeyError: 'price' Bottom first: KeyError: 'price' means a dictionary had no entry called price. The frame right above says it happened on line 2, in load_price. The frames above that are the callers. Line 7 shows the data that went in, and there it is: the second item says cost, not price.
Here is where vibe coding adds a trap. A quick AI fix might silence the error by making the code accept missing prices. That would make the red text disappear and hide the bad data. Ask the AI why the value is missing, not only how to stop the error. That is my advice from how this played out in a small test; I have not measured it across AI tools.
What to paste to the AI (and what to check first)
Pasting everything is not wrong, but pasting the right things gets you better answers. A short checklist:
- The command you ran (for example
node cart.js), so the AI knows where the error came from. - The whole error: for Node, from the
file:lineheader down through the first fewatlines; for Python, the full traceback. - The file named in the error, and any file the call chain passed through.
- What you changed right before it broke. This one fact saves the most time.
Then add one sentence: “Explain what this error means in plain English before you change anything.” That is my suggestion, and I have not tested whether it improves results in any particular tool. It does make you read the explanation, which is the point of this post.
⚠️ Scan before you paste
Error output can include file paths, URLs and sometimes values from your configuration. I did not see any secrets in my runs, but real projects differ. If you spot anything that looks like an API key or password, replace it with XXXX first. More on this in the env file security guide.
The honest limitations
I only tested Node and Python. Errors in the browser appear in the console (right-click the page, choose Inspect, then Console). Their text is similar to Node’s, but I did not test that here, so use the MDN error reference for the exact wording.
Real errors can be much longer. My test files were tiny, and I did not test bigger frameworks. The three questions should still apply — but finding your own file in a long trace takes patience.
My “plain meaning” column is a simplification. It is how I would explain each error to a friend — not an official definition. When it matters, read the official page.
Reading is not fixing. Knowing what, where and who called it gets you a clear sentence to give the AI. It does not guarantee the AI will fix it on the first try. If it keeps going in circles, write the plan down before you prompt or give it standing rules in a CLAUDE.md.
Who should actually care
Worth it if: you build with AI, you are not a programmer, and red text makes you close the laptop.
Maybe not if: you already read stack traces for a living; the table above will be nothing new.
Skip if: you never run code yourself and a teammate handles every error.
Quick answers
Do I need to understand the code to read an error?
No. You need to find three things: the error name and message, the first line that points at your own file, and the lines around it. You can do all three without reading the code itself.
Which end of the error do I read first?
In Python, the bottom: the last line says what happened. In Node, the error name sits near the top and the call chain runs downward from the crash. That is from my runs, and the Python rule is in the official docs.
Why does the error point at a line that looks fine?
Because the error shows where the program stopped, not where the mistake was made. In my test, the real cause was a missing argument three lines away, or a missing colon just before the flagged spot.
Should I paste the whole error into the AI?
Usually yes, together with the command you ran and what you changed last. Check it for anything that looks like a key or password first.
The bottom line
An error message is not a verdict on you. It is a short report: what happened, where, and who called it. Once you can read those three lines, you stop pasting blindly and start giving the AI something it can actually use.
Do this today: the next time you see red text, write one sentence before you paste anything: “It says [what], in [file:line], called from [who].”
Written Nov 11, 2026. Updates will be logged here: none yet.