Module 01Lesson 7 of 735 min
When the AI is confidently wrong
What you'll doSpot invented commands and libraries, ask how to verify a claim, and check it against the official docs.
An AI assistant never says "I'm not sure". It produces the most likely-looking answer, in the same confident tone whether it is right or invented. The invented ones are the expensive part, and they look exactly like the good ones.
You do not need to spot every mistake. You need three habits that catch the common ones in seconds.
The three tells
A function that doesn't exist. Real-looking method names on real objects — date.addDays(7), array.removeItem(x). They read perfectly and do not exist.
A flag that doesn't exist. A command with an option invented to match what you asked for.
A package that doesn't exist. An npm install line for a library with a name so sensible you assume it is real.
All three come from the same place: the assistant pattern-matches what a plausible answer looks like. Plausible is not the same as true.
Find the two mistakes
Here is an answer to "remind me a week before my event, and re-run my script whenever I save it". Two things in it do not exist. Read it before you keep going.
const eventDate = new Date("2026-12-31");
const reminderDate = eventDate.addDays(-7);
console.log(`Reminder on ${reminderDate}`);
node --watch-file countdown.js
Take a guess, then verify.
Verify, don't argue
Run it. The fastest check is the machine itself. Put that JavaScript in a file and run it:
node check.js
You get TypeError: eventDate.addDays is not a function. JavaScript dates have no addDays. That is the first mistake, and the error message names it exactly.
Ask the tool. Every command-line tool lists its own real options:
node --help
Search that output for --watch-file. It is not there — Node has --watch, which is what the assistant should have written. That is the second mistake.
Ask the registry. When an answer installs a package, check that the package exists before you install it:
npm view some-package-name
A real package prints its version and description. An invented one gives you a 404 from the registry.
The question that costs nothing
When an answer looks convenient, ask:
How can I verify that addDays exists on a JavaScript Date? Point me at the official
documentation, and tell me what to run to check it myself.
A good assistant will correct itself here. A bad answer doubles down — and either way you now have something you can check without trusting the answer at all.
What this is not
This is not a reason to distrust the assistant or to write everything by hand. You will use it in every lesson from here on. It is a reason to keep the loop from Lesson 5 intact: read before run, and let the error message — not your patience — be what tells you something is wrong.
Module 3 takes this much further. By the end of it you will be able to read AI-written code well enough to spot most of these before running anything.
If it didn't work
You found only one mistake. The second is in the command line, not the JavaScript. Run node --help and look for the option the answer used.
npm view hangs or errors about the network. You are offline, or behind a proxy. Skip that check for now; running the code and reading --help catch most cases anyway.
Your assistant wrote a version with no mistakes at all. That happens, and it is good news. The exercise still works: the two errors above are real, and the habits are the same.
Save point
git add .
git commit -m "Lesson 1.7: verifying AI answers"