VibecodingKeeping it workingLevel 2: Context

How Do You Get AI to Actually Fix a Bug?

Give it four things: the exact error, the steps that cause it, what you expected, and what happened instead. Then ask for the cause before any fix. "It's broken" makes the AI guess, and guesses add code. Most of the skill is finding the real error, which usually sits in your browser's console or your host's logs.

Prompt to copy
Find the cause of this bug before changing any code.

Steps to reproduce:
1. [what I did]
2. [what I clicked]
Expected: [what should happen].
Actual: [what happens instead].
Error (exact text): [paste from Console or logs, with tokens and keys removed].
Failed request: [method, URL path and status code from the Network panel].
When it started: [e.g. after adding search, or it worked yesterday].
Happens for: [everyone / only signed-out users / only on the live site].

Do this:
1. Reproduce it yourself if you can, and tell me whether you did.
2. Give me your top three possible causes, and say how you'd confirm each.
3. Confirm the most likely one by reading code or adding temporary logging. Don't change behavior yet.
4. Propose the smallest fix, and write a test that fails now and passes after the fix.
5. Tell me what else this fix could affect, and remove any temporary logging when finished.

Don't disable checks, security rules or tests to make the error go away.
A bug report AI can use
  • The exact errorCopied, not paraphrased, with secrets removed
  • The stepsWhich page, which click, since when
  • What you expectedThe result you meant to get
  • What happened insteadWhat the screen, Console and Network panel show
Rule of thumb, drawn from Lovable's debugging docs. Then ask for the cause before any fix.
  • 401 or 403Look at access rules and sign-in
  • 404Look for a wrong address
  • 500Read your server's log next
Rule of thumb for where to look first. A status code points you to a place, and it does not prove the cause.

Try it now

  1. 1Reproduce the bug with DevTools open (F12). Copy the red text from the Console panel, and in Network, find the failed request and note its status code.
  2. 2Fill in the prompt above, removing any tokens. In a plan or chat mode, the tool can investigate without editing anything.
  3. 3Run its confirmation step before you accept the fix. It's fixed when your original steps work, the new test passes, and related features still work.

Use it when

For any bug you can reproduce. Even a bug you can only trigger sometimes benefits, as long as you say that and describe when it last happened.

Skip it when

If you've already tried twice and it's still failing, use the fix loop card rather than sending a better version of the same request. And if a bug appears on the live site only, start with the deployment card.

Why it works

An AI can't see what you saw unless the tool connects it. Lovable's docs give the contrast: "Nothing works, fix it!" is the weak version, while a good report says what's blank, on which page and since when. Its docs add that repeated blind fixes pile up code that hides the real problem.

The error's location matters too. The browser Console shows front-end failures, and the Network panel shows failed requests and their status codes. A 401 or 403 points to access, 404 to a wrong address, and 500 to your server, so its log is the next place to look. Lovable reads your app's console logs itself in preview, but it can't see errors that only happen on the live site unless you paste them. On Vercel, those errors are under Logs, and on Replit they're in the Publishing pane's Logs tab.

Example

Weak: "Saving doesn't work, please fix." Strong: "On /projects/new, I fill in the name and click Save. I expected to reach the project page. The button spins forever. The Network panel shows POST /rest/v1/projects returning 403, and the Console shows new row violates row-level security policy. It started after adding teams."

That second version points straight at the access rule, not at the button. It also heads off a dangerous fix. Told only "it's broken", an AI might turn off row level security to clear the error. With this report and the prompt's last line, it should look for the missing insert policy instead.

Going further

Ask for a failing test before the fix. Anthropic's guide says to give Claude a check it can run, and a test that fails before the change and passes after it gives you evidence that a summary can't. In Claude Code, you can also pipe a log straight in: tail -200 app.log | claude -p "[your question]".

For bugs that appeared recently, ask what changed: "Compare the last working commit with now, and list changes that could cause this." Lovable suggests asking "why did this happen?" and which solutions were already tried, so you don't repeat them.

Remove secrets before pasting. Logs and copied requests often contain login tokens, and those can give someone access to an account.

Common mistakes

  • Paraphrasing the error. The exact wording, codes and file names are what make it useful.
  • Accepting a fix that removes a security check or hides the error, such as catching and ignoring it.
  • Only testing the case that was broken, and not what the fix might have affected.
  • Pasting a full log with tokens, keys or customers' details in it. Take out anything private first.

Sources

Checked 6 November 2026. Products change often, so confirm details with the vendor.

Related

Beyond the course