Vibe Coding: build real apps with AI · Episode 25. Every agent run below is real: Claude Code 2.1.322 (model claude-opus-5-5) in print mode (claude -p --permission-mode acceptEdits), on 12 November 2026, in /home/asha/projects/test-tracker (a Git repository). In this mode the agent may edit files but needs approval to run commands, and nobody approved, so it could not run the server, curl or any test. We ran and tested everything ourselves.
Tools used: Node.js v22.23.4, Chromium 153.0.8010.12 with its real DevTools (the Console and Network panels), Git 2.43.0, Python 3. The project and its data were made for this video: a tiny Node server, one HTML page and app.js, and data/marks.csv with 9,600 made-up marks (3 sections × 40 students × 5 subjects × 16 tests, April to November 2026). Line 4512 holds Simran's English mark: AB.
Sources (read on 12 November 2026): Chrome for Developers, Inspect network activity (last updated 2024-10-14); MDN, Error.prototype.stack; Git documentation, git-revert.
The problem: "Loading..." the night before the meeting
Asha's class built a small test tracker with AI last month: it shows the class average in each subject. Today she added the marks from July to November, from the teacher's sheet. Now the page says Loading... forever: no table, no error. The parent-teacher meeting is tomorrow morning.
The project:
test-tracker/
├── server.js a Node http server: the page + GET /api/averages
├── public/index.html the page
├── public/app.js fetches the averages and fills the table
└── data/marks.csv date,section,student,subject,marks (9,600 rows)
The original public/app.js:
async function load() {
const res = await fetch("/api/averages");
const data = await res.json();
render(data.subjects);
}
function render(subjects) {
const rows = subjects.map((s) =>
`<tr><td>${s.name}</td><td>${s.average.toFixed(1)}</td><td>${s.tests}</td></tr>`
);
document.getElementById("rows").innerHTML = rows.join("");
document.getElementById("status").textContent = "";
}
load();
The original averaging code in server.js:
function readMarks() {
const lines = fs.readFileSync(path.join(__dirname, "data", "marks.csv"), "utf8").trim().split("\n");
return lines.slice(1).map((line) => {
const [date, section, student, subject, marks] = line.split(",");
return { date, section, student, subject, marks: Number(marks) };
});
}
function averages(rows) {
const bySubject = {};
for (const r of rows) {
if (!bySubject[r.subject]) bySubject[r.subject] = { total: 0, tests: 0 };
bySubject[r.subject].total += r.marks;
bySubject[r.subject].tests += 1;
}
return Object.entries(bySubject).map(([name, s]) => ({
name,
average: s.total / s.tests,
tests: s.tests,
}));
}
Obvious way 1: "It doesn't work. Fix it." (real)
claude -p "The test tracker doesn't work. The page just says Loading... and nothing shows up. Fix it." --permission-mode acceptEdits
What really happened:
- It tried 9 shell commands (start the server,
curlthe API, scan the CSV). 7 were blocked: "This command requires approval". - So it read the code and guessed. It edited
server.js(skip lines whose marks are not numbers between 0 and 20, and print them) and rewrotepublic/app.js(show errors on the page instead of hanging): 49 lines added, 11 removed. - Its reply was honest: "I've made a fix, but I couldn't test it. Every command I tried needed approval and didn't run, so I never started the server or looked at the full marks file." Its guess: "one bad line ... like
ABfor absent".
Asha ran node server.js again and reloaded. The page now said:
Could not load the averages: Cannot read properties of null (reading 'toFixed')
It looked as if the fix had failed.
Obvious way 2: "Still broken. Please fix it." (real)
claude -p "I ran node server.js again and reloaded the page, but it's still broken. Now the page says: Could not load the averages: Cannot read properties of null (reading 'toFixed'). Please fix it." --permission-mode acceptEdits
- 8 commands tried, 5 blocked.
- It reasoned well: its new server code can't produce a
nullaverage, so "the bad data must be coming from an older server process that's still on port 3000". It added a clear message for that case inserver.js. - And, just in case, it changed
app.jsso that an average that isn't a number showsn/a:
`<tr><td>${s.name}</td><td>${Number.isFinite(s.average) ? s.average.toFixed(1) : "n/a"}</td><td>${s.tests}</td></tr>`
The real AI mistake: a fix that hides the bug
Reload: a full table, no error. But English: n/a. The old server was still running and still sending null for English. The n/a change fixed nothing; it hid the symptom. If Asha had stopped here, the page would have looked fine while the real fix never ran.
A fix that hides a symptom is worse than no fix: the bug is still there, and now nothing tells you.
Why it fails: the AI is debugging blind
- It cannot see your screen, your terminal or your browser.
- So it guesses, and every guess changes code, untested.
- "Still broken" → a bigger guess → more changed code: the loop of bad fixes.
The way out: you are the AI's eyes. Bring evidence, not "fix it". Real-life picture: at the doctor's, "I feel bad" gets a guess; "fever, 102, since Monday" plus a blood test and "does it hurt when I press here?" gets a diagnosis.
| At the doctor | Debugging |
|---|---|
| "I feel bad" | "It doesn't work" (a symptom) |
| "Fever, 102, since Monday" | The error message and stack trace |
| Blood test report | The Network tab and the server log |
| "Does it hurt when I press here?" | Reproducing the bug |
Evidence 1: the error message
TypeError: Cannot read properties of null (reading 'toFixed')
- TypeError: the kind of error: a value of the wrong type was used.
- null: "no value at all".
nullis not a number, so it has notoFixed. - toFixed(1): rounds a number to 1 decimal place and returns text:
(13.95).toFixed(1)is"14.0". - Meaning: something we expected to be a number was
null.
Evidence 2: the stack trace (Chrome DevTools Console)
Open DevTools with Ctrl+Shift+J (Windows/Linux) or Cmd+Option+J (Mac). The real Console showed:
Uncaught (in promise) TypeError: Cannot read properties of null (reading 'toFixed')
at app.js:9:44
at Array.map (<anonymous>)
at render (app.js:8:25)
at load (app.js:4:3)
GET http://localhost:3000/favicon.ico 404 (Not Found)
A stack trace is the list of function calls that led to the error. MDN: "The call that directly caused the error is placed at the top, and the call that started the whole call chain is placed at the bottom." So: line 9, column 44 of app.js, inside render, which load called at line 4.
Line 9 is where it crashed, not where the bug started. s.average was already null when it arrived. Because the code stopped there, the next lines never ran: the table stayed empty and "Loading..." was never cleared. That explains the symptom exactly.
Not every red line is your bug
favicon.ico 404 is also red. A favicon is the small icon in the browser tab; browsers request it by themselves, and this server has none, so the answer is 404 (not found). It's harmless. We tried giving the AI only that line (real run):
claude -p "The page is stuck on \"Loading...\" and the table stays empty. The browser console shows this error: GET http://localhost:3000/favicon.ico 404 (Not Found). Fix it." --permission-mode acceptEdits
It replied: "The favicon 404 is harmless on its own (browsers request it automatically), so it's probably not what's blocking the table." A good catch, but it still rewrote two files without running them. Rule: pick the error that matches the symptom (the table is empty; the TypeError is in render, which fills the table).
Evidence 3: the terminal (the error everyone misses)
After the first fix Asha had typed node server.js again, but she looked only at the browser. The terminal had printed (real):
node:events:497
throw er; // Unhandled 'error' event
^
Error: listen EADDRINUSE: address already in use 0.0.0.0:3000
at Server.setupListenHandle [as _listen2] (node:net:1941:16)
at listenInCluster (node:net:1998:12)
at Server.listen (node:net:2103:7)
at Object.<anonymous> (/home/asha/projects/test-tracker/server.js:72:8)
at Module._compile (node:internal/modules/cjs/loader:1781:14)
...
code: 'EADDRINUSE',
errno: -98,
- EADDRINUSE = "address in use": the port is taken.
- Most lines are inside Node itself (
node:net,node:internal). The only line from Asha's files isserver.js:72:8, theserver.listen(PORT, ...)line. - So the new server crashed at once, and the old server, started before any fix, kept answering the browser.
Process and port: a process is one running copy of a program. A port is a numbered "door" on the computer where a server listens; only one process can listen on a port at a time. The fix isn't code: stop the old process (Ctrl+C in its terminal, or on Mac/Linux kill $(lsof -t -i :3000)).
After the AI's port message (run 2), a second start prints:
Port 3000 is already in use - probably an older copy of this server is still running.
Stop it (Ctrl+C in its terminal, or: kill $(lsof -t -i :3000)) and run node server.js again.
Evidence 4: the DevTools Network tab
Chrome's docs: "use the Network panel when you need to make sure that resources are being downloaded or uploaded as expected." Each request the page makes is a row:
| Name | Status | Type | Initiator |
|---|---|---|---|
| localhost | 200 | document | Other |
| app.js | 200 | script | (index):21 |
| averages | 200 | fetch | app.js:2 |
| favicon.ico | 404 | text/plain | Other |
- Status = "The HTTP response code": 200 OK, 404 Not Found, 500 server error.
- "DevTools only logs network activity while it's open": open it, then reload.
- Click averages → Response to see the exact data the server sent (real, original code):
{ "name": "Maths", "average": 13.955729166666666, "tests": 1920 },
{ "name": "Science", "average": 13.8515625, "tests": 1920 },
{ "name": "English", "average": null, "tests": 1920 },
{ "name": "Hindi", "average": 14.090104166666666, "tests": 1920 },
The request worked (200), but the server sent null for English: the bug is on the server, in the English data.
In the n/a state the Response was the same: "average": null and no "skipped" list, which the AI's new server code always sends. That's proof the old server answered, and that n/a only covered it up.
Reproduce it small (run in the compiler)
Reproduce = make the bug happen again, on purpose, every time. Make the case small: 4 rows, not 9,600.
// Reproduce the bug with 4 rows instead of 9,600
const csv = `date,section,student,subject,marks
2026-07-13,B,Pooja,English,15
2026-07-13,B,Om,English,12
2026-07-13,B,Simran,English,AB
2026-07-13,B,Harsh,English,17`;
let total = 0, tests = 0;
for (const line of csv.split("\n").slice(1)) {
const marks = Number(line.split(",")[4]);
total += marks;
tests += 1;
}
const average = total / tests;
console.log("average:", average);
console.log("as JSON:", JSON.stringify({ average }));
Output:
average: NaN
as JSON: {"average":null}
NaN ("Not a Number") is what JavaScript gives when maths goes wrong: Number("AB") is NaN, and NaN plus anything is NaN. JSON (the text format servers and pages exchange) has no NaN, so JSON.stringify writes null. The Network tab's null, reproduced.
console.log debugging
Add one line inside the loop, after tests += 1;:
console.log(line, "-> marks:", marks, "| total:", total);
Output:
2026-07-13,B,Pooja,English,15 -> marks: 15 | total: 15
2026-07-13,B,Om,English,12 -> marks: 12 | total: 27
2026-07-13,B,Simran,English,AB -> marks: NaN | total: NaN
2026-07-13,B,Harsh,English,17 -> marks: 17 | total: NaN
average: NaN
Look for the first wrong value: Simran's AB. Remove debug lines when you're done.
Python: traceback and print debugging
def read_marks(lines):
marks = []
for line in lines:
marks.append(float(line.split(",")[4]))
return marks
def average(lines):
marks = read_marks(lines)
return sum(marks) / len(marks)
rows = ["2026-07-13,B,Pooja,English,15",
"2026-07-13,B,Simran,English,AB",
"2026-07-13,B,Harsh,English,17"]
print("English average:", average(rows))
Output (Python 3; the file path will differ on your computer):
Traceback (most recent call last):
File "tb.py", line 14, in <module>
print("English average:", average(rows))
~~~~~~~^^^^^^
File "tb.py", line 8, in average
marks = read_marks(lines)
File "tb.py", line 4, in read_marks
marks.append(float(line.split(",")[4]))
~~~~~^^^^^^^^^^^^^^^^^^^^
ValueError: could not convert string to float: 'AB'
Python's traceback says "most recent call last": the line that broke is at the bottom (line 4, in read_marks), the opposite order to JavaScript's stack trace. Python stops loudly instead of producing NaN.
Print debugging in Python: add print("reading:", line) as the first line inside the loop:
reading: 2026-07-13,B,Pooja,English,15
reading: 2026-07-13,B,Simran,English,AB
Traceback (most recent call last):
...
ValueError: could not convert string to float: 'AB'
The last line printed before the crash is the bad row.
Roll back the cover-up, stop the old server (real)
$ git diff --stat
public/app.js | 2 +-
server.js | 11 +++++++++++
2 files changed, 12 insertions(+), 1 deletion(-)
$ git restore public/app.js # throw away the n/a change
$ git status --short
M server.js # keep the port message
$ kill $(lsof -t -i :3000) # stop the OLD server
$ node server.js
Test tracker running at http://localhost:3000
Skipped 1 line(s) in marks.csv:
line 4512: 2026-07-13,B,Simran,English,AB
git diff --statlists uncommitted changes per file.git restore <file>throws away the uncommitted changes in that file (back to the last commit).
Reload: every subject has an average, English shows 1,919 marks, and the page says "Note: 1 line(s) in marks.csv were skipped because the marks were missing or invalid (line 4512)." The first AI fix was right all along; it never ran.
Giving the AI the exact error (agent run 4)
A debugging prompt that works has five parts:
- What you did, and what you found.
- The exact error or log, copied and pasted, never retyped.
- Expected vs actual.
- What must not change.
- "Change only what's needed."
Found it. An old copy of the server was still running on port 3000, so my restart failed with EADDRINUSE. I stopped it, and now the page loads. The server terminal says:
Skipped 1 line(s) in marks.csv:
line 4512: 2026-07-13,B,Simran,English,AB
AB is not a mistake: the teacher writes AB when a student was absent. Expected: absent marks are not counted in the average, and the table gets an "Absent" column with how many AB entries each subject has. Actual: AB is treated as an invalid line and the page shows a warning about it.
Keep warning about lines that really are invalid (a blank mark, a mark above 20, wrong number of columns). Change only what's needed for this.
It made three small edits (server.js, public/app.js, public/index.html) and warned: "Only AB in capitals counts as absent. A lowercase ab would still be reported as invalid. Tell me if the teacher sometimes writes it that way."
Result (real): a new Absent column; English 14.1, 1,919 marks, 1 absent; no warning.
Our test, on a copy with two extra lines (2026-11-09,A,Ravi,Maths,25 and 2026-11-09,A,Neha,Maths,ab):
Skipped 2 line(s) in marks.csv:
line 9602: 2026-11-09,A,Ravi,Maths,25
line 9603: 2026-11-09,A,Neha,Maths,ab
Both flagged: 25 (above 20) correctly, and lowercase ab exactly as the AI warned. The teacher's sheet uses only capitals, so that's fine.
Breaking the loop
- Two failed fixes in a row? Stop prompting.
- Roll back to the last version that worked.
- Collect evidence: the error, the stack trace, the terminal, the Network tab, the server log.
- Ask for possible causes and how to check each, before any code changes ("Don't change code yet: list 3 likely causes and a command or check for each").
- If the chat is long and confused, start a fresh chat with just the evidence, and ask for one small change.
- Commit before every AI change, so rolling back is one command.
Rolling back committed changes: git revert (real)
$ git log --oneline
c121898 AB = absent: own column, not in the average (Claude Code, prompt 4)
e781934 Clear message when port 3000 is already in use
e0e6d97 AI fix: skip bad rows, show errors on the page
1c4a325 Add July to November marks from the teacher's sheet
99007de Class test tracker: averages per subject
$ git revert --no-edit HEAD # on a practice copy
[master ac597f5] Revert "AB = absent: own column, not in the average (Claude Code, prompt 4)"
3 files changed, 5 insertions(+), 18 deletions(-)
The Git docs: git revert is "used to record some new commits to reverse the effect of some earlier commits (often only a faulty one)". The history keeps both commits. For uncommitted changes the docs point to git reset --hard and git restore, with a warning: "Take care with these alternatives as both will discard uncommitted changes in your working directory."
| Situation | Command |
|---|---|
| Undo uncommitted changes in one file | git restore <file> |
| Undo a commit, keep history | git revert <commit> |
| Throw away all uncommitted work (careful!) | git reset --hard |
The finished app (all files)
server.js:
// Class test tracker: average marks per subject for our class tests.
const http = require("http");
const fs = require("fs");
const path = require("path");
const PORT = 3000;
// Returns the valid rows, plus any lines that could not be used (wrong number
// of columns, blank or non-numeric marks, or marks outside 0-20).
// "AB" means the student was absent: it is kept as a row with absent: true and
// counted separately, not used in the average and not reported as skipped.
// One bad line used to turn a subject's average into NaN, which JSON sends as
// null, and the page crashed on null.toFixed() and stayed on "Loading...".
function readMarks() {
const lines = fs.readFileSync(path.join(__dirname, "data", "marks.csv"), "utf8").split(/\r?\n/);
const rows = [];
const skipped = [];
lines.forEach((raw, i) => {
const line = raw.trim();
if (i === 0 || line === "") return; // header or blank line
const parts = line.split(",").map((p) => p.trim());
const marksText = parts[4];
if (parts.length === 5 && marksText === "AB") {
const [date, section, student, subject] = parts;
rows.push({ date, section, student, subject, absent: true });
return;
}
const marks = Number(marksText);
if (parts.length !== 5 || marksText === "" || !Number.isFinite(marks) || marks < 0 || marks > 20) {
skipped.push({ line: i + 1, text: line });
return;
}
const [date, section, student, subject] = parts;
rows.push({ date, section, student, subject, marks });
});
return { rows, skipped };
}
function averages(rows) {
const bySubject = {};
for (const r of rows) {
if (!bySubject[r.subject]) bySubject[r.subject] = { total: 0, tests: 0, absent: 0 };
if (r.absent) {
bySubject[r.subject].absent += 1;
continue;
}
bySubject[r.subject].total += r.marks;
bySubject[r.subject].tests += 1;
}
return Object.entries(bySubject).map(([name, s]) => ({
name,
// null when every entry for the subject is AB (nothing to average)
average: s.tests ? s.total / s.tests : null,
tests: s.tests,
absent: s.absent,
}));
}
const server = http.createServer((req, res) => {
if (req.url === "/api/averages") {
try {
const { rows, skipped } = readMarks();
if (skipped.length) {
console.warn(`Skipped ${skipped.length} line(s) in marks.csv:`);
skipped.slice(0, 20).forEach((s) => console.warn(` line ${s.line}: ${s.text}`));
}
const data = { subjects: averages(rows), skipped };
res.writeHead(200, { "Content-Type": "application/json" });
return res.end(JSON.stringify(data));
} catch (err) {
console.error(err);
res.writeHead(500, { "Content-Type": "application/json" });
return res.end(JSON.stringify({ error: "Could not read data/marks.csv: " + err.message }));
}
}
const file = path.join(__dirname, "public", req.url === "/" ? "index.html" : req.url);
fs.readFile(file, (err, body) => {
if (err) { res.writeHead(404); return res.end("Not found"); }
const type = file.endsWith(".js") ? "text/javascript" : "text/html";
res.writeHead(200, { "Content-Type": type });
res.end(body);
});
});
server.on("error", (err) => {
if (err.code === "EADDRINUSE") {
console.error(
`Port ${PORT} is already in use - probably an older copy of this server is still running.\n` +
`Stop it (Ctrl+C in its terminal, or: kill $(lsof -t -i :${PORT})) and run node server.js again.`
);
process.exit(1);
}
throw err;
});
server.listen(PORT, () => console.log(`Test tracker running at http://localhost:${PORT}`));
public/app.js:
async function load() {
const status = document.getElementById("status");
try {
const res = await fetch("/api/averages");
const data = await res.json();
if (!res.ok) throw new Error(data.error || `Server returned ${res.status}`);
render(data.subjects);
if (data.skipped && data.skipped.length) {
const first = data.skipped.slice(0, 5).map((s) => `line ${s.line}`).join(", ");
status.textContent =
`Note: ${data.skipped.length} line(s) in marks.csv were skipped because the marks were missing or invalid (${first}${data.skipped.length > 5 ? ", ..." : ""}).`;
}
} catch (err) {
status.textContent = "Could not load the averages: " + err.message;
}
}
function render(subjects) {
const rows = subjects.map((s) =>
`<tr><td>${s.name}</td><td>${s.average === null ? "–" : s.average.toFixed(1)}</td><td>${s.tests}</td><td>${s.absent}</td></tr>`
);
document.getElementById("rows").innerHTML = rows.join("");
document.getElementById("status").textContent = subjects.length ? "" : "No marks found in data/marks.csv.";
}
load();
public/index.html:
<!doctype html>
<html>
<head>
<meta charset="utf-8">
<title>Class Test Tracker</title>
<style>
body { font-family: system-ui, sans-serif; max-width: 640px; margin: 40px auto; color: #1d2433; }
h1 { font-size: 28px; }
table { width: 100%; border-collapse: collapse; font-size: 20px; }
th, td { text-align: left; padding: 10px; border-bottom: 1px solid #dde; }
#status { color: #667; font-size: 20px; }
</style>
</head>
<body>
<h1>Class 8 · Test averages</h1>
<p id="status">Loading...</p>
<table>
<thead><tr><th>Subject</th><th>Average (out of 20)</th><th>Marks entered</th><th>Absent</th></tr></thead>
<tbody id="rows"></tbody>
</table>
<script src="app.js"></script>
</body>
</html>
Common mistakes (real)
| Mistake | What you see | Why | Fix |
|---|---|---|---|
| "It doesn't work, fix it" | 7 of 9 commands blocked; an untested guess | No evidence | Paste the exact error and log |
| Trusting a fix that hides the bug | English: n/a, no error |
Symptom hidden, cause kept | Check the Network tab's Response |
| Pasting the wrong red line | GET .../favicon.ico 404 (Not Found) |
Unrelated to the table | Match the error to the symptom |
| Not reading the terminal | Error: listen EADDRINUSE: address already in use 0.0.0.0:3000 |
The old server is still running | Ctrl+C the old process, restart |
| Fixing where it crashed | TypeError ... (reading 'toFixed') at app.js:9:44 |
The null came from the server |
Trace the bad value back to its source |
Number("AB") in a sum |
average: NaN → JSON null |
NaN spreads through maths | Validate input; decide what AB means |
float("AB") in Python |
ValueError: could not convert string to float: 'AB' |
Text isn't a number | Handle it explicitly |
Mini project
- Take any project from this course and break it on purpose: rename a field in the server's JSON (for example
average→avg). - Find the evidence: the Console error, the stack trace's top line, and the Network tab's Response.
- Reproduce it in under 10 lines in the compiler.
- Write a five-part debugging prompt. Commit first; check the AI's diff with
git diffbefore you accept it; undo it withgit restoreif it hides the bug.
Practice questions
- Why couldn't the AI test its first fix?
Answer
In accept-edits mode it could edit files but every shell command needed approval, and nobody approved. 7 of its 9 commands never ran, so it guessed from the code.
- After the
n/achange the page showed a full table and no error. Why was that bad?
Answer
It hid the symptom without fixing the cause: the old server was still running and still sending null for English. The page looked fine, so nobody would look further.
- In a JavaScript stack trace, which line is where the error happened? In a Python traceback?
Answer
JavaScript (V8/Chrome): the top line. Python: the bottom line ("most recent call last").
- The console shows
favicon.ico 404and aTypeErrorinrender. The table is empty. Which one do you give the AI, and why?
Answer
The TypeError: it is in render, the function that fills the table, so it matches the symptom. A missing favicon only affects the tab icon.
- What does
EADDRINUSEmean, and what's the fix in this episode?
Answer
"Address in use": another process is already listening on the port (3000). Stop the old server (Ctrl+C in its terminal, or kill $(lsof -t -i :3000) on Mac/Linux), then start the new one.
- The Network tab shows
averageswith status 200. Does that mean the data is right?
Answer
No. 200 only means the request succeeded. Open the Response: here it contained "average": null for English.
- What does
console.log(JSON.stringify({ x: 0 / 0 }))print?
Answer
{"x":null}. 0 / 0 is NaN, and JSON has no NaN, so it is written as null.
- Why reproduce a bug with 4 rows instead of the real 9,600?
Answer
Small cases are fast to run and easy to read, so you can see the first wrong value; and a small repeatable case can be re-run after the fix to prove it works.
- You want to undo an AI change that is already committed, and keep a record. Which command?
Answer
git revert <commit>: it adds a new commit that reverses the old one. (git restore is for uncommitted changes.)
- Write the five parts of a good debugging prompt.
Answer
What you did and found; the exact error/log pasted; expected vs actual; what must not change; "change only what's needed".
Quiz
The page looks fine after the AI's fix. How do you check?
A) Trust it: no red errors
B) Ask the AI if it's fixed
C) Network tab: read the real response
D) Reload ten more times
Answer
C. The Network tab's Response shows the exact data the server sent. In this episode the page looked fine with "n/a", but the response still had "average": null and no "skipped" list: the old server was answering. No errors and the AI's opinion are not proof.
Interview questions
- Walk me through how you debug a web page that is stuck on "Loading...".
- What is a stack trace, and how do you find the line that matters when most lines are inside libraries?
- What's the difference between where an error is thrown and where the bug is? Give an example.
- How do you use the browser's Network panel to tell a front-end bug from a back-end bug?
- What does
EADDRINUSEmean? How would you find which process holds a port? - Why is "make the error go away" not the same as fixing it? (Example: a fallback like
n/athat hides bad data.) - When working with an AI coding agent, how do you stop a loop of bad fixes?
git restore,git revert,git reset --hard: when would you use each?
Glossary
| Term | Meaning (plain words) | Example |
|---|---|---|
| Bug | A mistake that makes a program do the wrong thing | The page stuck on "Loading..." |
| Debugging | Finding the cause of a bug and fixing it | Tracing null back to AB |
| Symptom | What you see going wrong, not why | "Loading..." forever |
| Error message | The sentence a program prints when it fails | Cannot read properties of null (reading 'toFixed') |
| TypeError | A JavaScript error: a value of the wrong type was used | calling toFixed on null |
| ValueError | A Python error: right type, unusable value | float("AB") |
| null | "No value at all" | "average": null |
| NaN | "Not a Number": the result of maths that went wrong | Number("AB") |
| toFixed | Rounds a number to some decimals, as text | (13.95).toFixed(1) → "14.0" |
| Stack trace | The list of function calls that led to an error, newest first (JavaScript) | at render (app.js:8:25) |
| Traceback | Python's stack trace, newest call last | File "tb.py", line 4, in read_marks |
| Line:column | Where in the file: line number and character position | app.js:9:44 |
| Red herring | A clue that looks important but isn't | The favicon 404 |
| Favicon | The small icon in the browser tab; browsers request it automatically | /favicon.ico |
| DevTools | The developer tools built into the browser | Ctrl+Shift+J |
| Console panel | The DevTools panel that shows errors and console.log output |
The TypeError and stack trace |
| Network tab (panel) | The DevTools panel that lists every request and its response | averages 200 |
| Request / response | What the page asks the server / what the server sends back | GET /api/averages → JSON |
| HTTP status code | The server's short answer to a request | 200 OK, 404 Not Found, 500 error |
| JSON | A text format programs use to exchange data | {"average": 13.9} |
| fetch | The browser function that makes a request from JavaScript | fetch("/api/averages") |
| Terminal | The text window where you run commands like node server.js |
Where EADDRINUSE appeared |
| Process | One running copy of a program | The old server |
| Port | A numbered "door" where a server listens; one process per port | 3000 |
| EADDRINUSE | "Address in use": the port is already taken | listen EADDRINUSE ... :3000 |
| Reproducing a bug | Making it happen again on purpose, every time | 4 rows that give NaN |
| Minimal reproduction | The smallest case that still shows the bug | 16 lines in the compiler |
| console.log / print debugging | Printing values step by step to see where they go wrong | -> marks: NaN |
| Server log | What the server prints while it runs | Skipped 1 line(s) ... line 4512 |
| Hiding a symptom | Making the error disappear without fixing the cause | Showing n/a |
| Loop of bad fixes | Guess → still broken → bigger guess, round and round | Prompts 1 and 2 |
| Rolling back | Returning code to an earlier, working version | git restore public/app.js |
| git diff | Shows what changed since the last commit | git diff --stat |
| git restore | Throws away uncommitted changes in a file | git restore public/app.js |
| git revert | Adds a new commit that undoes an earlier one | git revert --no-edit HEAD |
| Commit | A saved snapshot of the project in Git | e781934 Clear message when port ... |
| Accept edits | An agent mode where it may edit files without asking, but needs approval to run commands | --permission-mode acceptEdits |
Summary
- "It doesn't work, fix it" makes the AI guess. Here it couldn't run anything (7 of 9 commands blocked), so every fix was untested.
- The real AI mistake: an
n/afallback that made the page look fixed while the old server kept sendingnull. Hidden is not fixed. - Evidence beats guessing: the error message (what), the stack trace (where: top in JavaScript, bottom in Python), the terminal (
EADDRINUSE: an old server on port 3000), and the Network tab (status code and the real response). - Reproduce it small, print until you see the first wrong value, roll back what hid the bug (
git restore,git revert), and give the AI the exact error with expected vs actual. - Break the loop: after two failed fixes, stop, roll back, collect evidence, ask for causes before code, and commit before every AI change.
Next episode: Git and GitHub for vibe coders: repository, commit, branch, diff, push, pull request, .gitignore.