AI Dev Guide
Debugging Beginner

How to Read and Report Errors

Learn how to read error messages and communicate them effectively to AI coding tools

Errors Aren’t “Broken”

An error message isn’t a sign that something is broken — it’s a signpost saying “the problem is here.”

Red text on screen can be intimidating at first, but once you learn to read it, errors become useful information.

How to Read an Error Message

A typical error looks like this:

Error: Cannot find module 'react'
    at Function.Module._resolveFilename (node:internal/modules/cjs/loader:933:15)
    at Function.Module._load (node:internal/modules/cjs/loader:778:27)
    at Module.require (node:internal/modules/cjs/loader:1005:19)
    at require (node:internal/modules/cjs/helpers:102:18)
    at Object.<anonymous> (/Users/you/my-project/src/App.tsx:1:1)

You only need to read the first two lines:

PartMeaning
Error: Cannot find module 'react'What happened (react wasn’t found)
at Object.<anonymous> (/Users/.../App.tsx:1:1)Where it happened (App.tsx, line 1)

The remaining lines are the “stack trace” — the path the error traveled. You can ignore these at first.

Common Error Patterns

Cannot find module 'xxx'

The package isn’t installed.

npm install xxx

SyntaxError: Unexpected token

Something is wrong with the code syntax. Missing closing brackets, commas, etc.

TypeError: Cannot read properties of undefined

You’re trying to access something that doesn’t exist. A variable is undefined (empty) but your code tries to use it.

ENOENT: no such file or directory

The file or folder doesn’t exist. Usually a typo in the path.

EACCES: permission denied

No permission to access the file. sudo might help, but ask the AI first — it’s safer.

How to Report Errors to AI

Bad

It doesn't work

AI can’t read your mind. It doesn’t know what “it” is or what “work” means.

Good

I ran npm run dev and got this error:

Error: Cannot find module 'react'
    at Function.Module._resolveFilename ...

What I've done:
1. npm install was already run
2. react is listed in package.json

Best: Use This Template

[Paste the full error message]

[What you were trying to do]
- Command: npm run dev
- Expected: Dev server starts
- Actual: Error above, server doesn't start

[What you already tried]
- Ran npm install again → same error

Tips

1. Copy the Full Error Message

Partial error messages lead to inaccurate answers from AI.

2. Keep It in English

Don’t translate error messages. AI understands them as-is.

3. Mention What You Just Did

Errors almost always happen right after a change. Mentioning what you just did speeds up diagnosis.

4. Text Over Screenshots

Paste error messages as text, not screenshots. AI may not be able to read text from images reliably.

Next Steps