Free 15-minute callFree 15-minute call →
艾维禾砺Vibe Coding LabIvheli · 1:1 coaching
Practice notes

How to fix AI code errors

AI-generated code that will not run is a normal step. What really slows progress is not knowing where to look. This order narrows the problem to something manageable even without development experience.

Updated 2026-11-113 min readFree guides · 9/96

Step 1: preserve the scene first

The worst reaction to an error is to start over immediately. Do three things first:

  1. Copy the full error: do not screenshot a single line; keep the type, the location and a few lines before and after
  2. Note what you just did: which button you clicked, what you entered, which part you changed
  3. Confirm the current version: keep a working version so you can roll back if needed

With these three, the problem is at least reproducible.

Step 2: read the error in three parts

Most error messages can be split into three parts:

  • Error type: for example, variable not found, type mismatch, network request failed
  • Location: which file, which line, which stage (page, API, build)
  • Expected versus actual: what it expected to receive, and what it actually received

Paste these three parts to AI and ask it to explain first and then suggest how to verify, rather than changing the code straight away.

Step 3: reproduce with the shortest path

The shorter the reproduction path, the easier it is to locate:

  • Keep only the operation that triggers the problem and remove unrelated steps
  • Use fixed input so the result does not differ every time
  • Try on both computer and phone to see whether it only appears on one side
  • Record whether it happens every time or only occasionally, because the handling is completely different

Step 4: classify the problem

Type Typical sign Start with
Syntax / structure Blank page, build fails immediately Look at the first error and fix the earliest one
Dependency / environment Missing module on start-up Reinstall dependencies as the project README says, and confirm versions
API / network Request fails, cross-origin, timeout Check the request URL, status code and response body
Data Wrong results, miscalculated numbers Compare using input whose answer you know
Permissions Another account can see what it should not Stop and check with the permission review process
Deployment / environment differences Works locally, fails online Compare configuration and files on both sides

After classifying, decide whether to fix it yourself, have AI fix it, or ask someone to look first.

Step 5: change one thing at a time and verify

  • Let AI change only one point at a time, then reproduce immediately with the same input
  • After each change, confirm that previously working features still work
  • Write down the symptom, cause and fix, and add them to the project notes
  • Keep a working version before moving on

The troubleshooting record is an asset itself: the next time a similar problem appears, you can follow it directly.

Two common mistakes

Mistake one: paste all the errors to AI at once. Multiple errors interfere with each other. Deal with the earliest one first; the later ones often disappear on their own.

Mistake two: change the result without changing the cause. For example, hard-coding a number to the right value looks fixed, but another input breaks again. Make the result reproducible first, then make the cause clear.

When to stop and ask for help

  • The problem involves account permissions, client data or a live incident: roll back first and preserve the scene
  • The same problem has been changed back and forth several times and is still unstable: the real cause has not been found yet
  • It involves payments, API integration or the deployment environment: confirm the risk boundary first

These cases are best looked at together with the material. Our one-to-one coaching practises this troubleshooting order, and you can also talk to us free for 15 minutes to explain the current blocker before deciding.

Questions

What if I do not understand the error message?

Copy the full error text first, then ask AI to explain three things: the error type, where it appears, and what was expected versus what actually happened. After that, ask for a minimal way to verify, rather than a full rewrite of the file.

Is it faster to let AI rewrite the whole file?

It looks fast, but the scope of change is uncontrolled and it easily breaks parts that already worked. A steadier approach is to change one thing at a time, then reproduce with the same input to verify.

What if the error never gets fixed?

Roll back to the last working version first, then ask for help with the reproduction steps, the full error text and the current version. If account permissions, client data or a live incident are involved, stop, preserve the scene, and then decide whether to look at it with someone.

Want to apply this to your own work?

Read next

Share this article

Where should your idea start?

Bring an idea or a question to a free 15-minute call. Confirm the conversation language and time when booking.

Book a free 15-minute call

Where should your idea start?

Free 15-minute call →Free guides

Book a free 15-minute call

Contact

Booking formEnterprise AI implementation & system developmentSee enterprise services (official site)
Add us on WeChat, mention Vibe Coding and tell us what you want to do
Add us on WeChat, mention Vibe Coding and tell us what you want to do