How to Debug a Vibe-Coded App: fix it without the doom loop
Your AI-built app broke and "fix it" isn't working. This beginner guide gives you a calm, repeatable debugging process: reproduce the bug, read the first error, make the smallest fix, roll back when needed, and prove it really works.

To debug a vibe-coded app, stop asking the AI to "fix it" blindly. Instead, reproduce the bug, copy the exact first error message, describe what you expected versus what happened, ask the AI for the root cause before it changes anything, apply the smallest possible fix, and then test it yourself. If fixes keep piling up, roll back to the last working version and try again with a clearer prompt.
That's the short answer. The rest of this guide shows you how to do each step, even if you've never opened a browser console, with copy-paste prompts and the built-in tools that app builders like Lovable and Replit already give you. If you're new to the term itself, start with what vibe coding means and our complete guide to vibe coding.
- Reproduce it: write down the steps that cause the bug, what you expected and what actually happened.
- Find the clue: open the browser console (F12, or Cmd+Option+I on a Mac) and copy the first red error, in full.
- Diagnose first: ask the AI "what's the root cause?" in a plan or chat mode before it edits code.
- Fix small: ask for the smallest possible change, one bug at a time.
- Roll back early: after two failed fixes, restore the last working version instead of stacking patches.
- Verify yourself: the AI saying "fixed" isn't proof. Re-run your steps and your tests.
Why vibe-coded apps are hard to debug
When you write code yourself, you usually have a rough mental map of how it works. When you vibe code, the AI wrote the code and you may never have read it. That's the whole point of vibe coding in Andrej Karpathy's original February 2, 2025 description: you go with the vibes, accept the changes and paste error messages back in without comment. It works brilliantly for small projects, right up until something breaks in a way the AI can't immediately fix.
Then a familiar pattern starts. You type "it's still broken, fix it". The AI confidently changes something. A different thing breaks. You paste the new error. It changes something else. Twenty minutes and a pile of credits later, the app is worse than when you started. Call it the doom loop.
The people who build these tools warn about exactly this. Lovable's own debugging guide says to use its "Try to fix" button "once or twice" and then "stop retrying blind fixes", because "repeated blind fixes tend to pile up code that hides the real problem." Developer and author Andrew Stellman, writing for O'Reilly Radar in September 2025, listed "small fixes that keep breaking somewhere else" as a warning sign of deeper design problems in AI-generated code.
A few other reasons vibe-coded bugs are tricky:
- The AI can be confidently wrong. Karpathy's own write-up of building his MenuGen app with Cursor and Claude noted that the AI "kept hallucinating deprecated APIs". Code that looks plausible can call functions that no longer exist.
- Bugs hide in places you can't see. Login, databases, environment variables and API keys often fail only after you publish, not in the preview.
- Every fix changes more code. Big rewrites can silently break features that used to work.
- Security bugs don't announce themselves. Veracode's 2025 GenAI Code Security Report found AI-generated code introduced security flaws in 45% of cases across 80 tasks and 100+ models. An app can "work" and still be unsafe.
The good news: debugging is a learnable routine, and you don't need to become a full-time developer to do it well.
debuggingnoun
/diːˈbʌɡɪŋ/ · in vibe coding: finding and fixing why an AI-built app doesn't behave as intended- The process of finding the cause of a bug (unexpected or wrong behavior) in software and changing the code so it works as intended.
- In vibe coding: guiding an AI to the real cause of a problem with clear evidence (steps, errors, screenshots), then checking its fix yourself.
The 7-step debugging loop for vibe coders
Different sources use different words, but they agree on the same basic loop: reproduce, gather evidence, diagnose, make a small fix, verify, and roll back when you're stuck. Here it is as a checklist you can follow every time.
Step 1: Stop and save what still works
Before you touch anything, make sure you can get back to a known state. In Lovable, that's version history. In Replit, the Agent creates checkpoints as it works; Replit's docs compare them to "save points in a video game" and note that "each checkpoint creates a corresponding Git commit." If you use Cursor, Claude Code or another editor with Git, commit your current state with a message like "before debugging login bug". Five seconds now can save an hour later.
Step 2: Reproduce the bug on purpose
A bug you can trigger reliably is half fixed. Write three things down:
- Steps to reproduce: exactly what you clicked or typed.
- Expected result: what should have happened.
- Actual result: what happened instead.
This "expected vs actual" format turns "it's broken" into something an AI can work with. The Dyad team's January 2026 list of prompts for fixing vibe-coded apps calls it "the fastest way to turn 'it is broken' into something debuggable." If the bug only happens sometimes, note when: only on mobile? only after logging in? only on the published site?
Step 3: Collect the evidence
The AI can't see your screen unless you show it. Gather:
- The exact error message. Copy and paste the whole thing. Don't summarize or translate it; as one developer's September 2026 debugging guide puts it, the parts you think don't matter are often the key.
- The first error, not just the last. When several red errors appear, the first one is often the real cause and the rest are knock-on effects.
- A screenshot for visual bugs (layout, overlapping text, missing buttons).
- Where it happens: preview or live site, which page, which browser.
Lovable notes that it reads your app's console logs itself, but pasting an exact error message still helps, especially for errors that only appear on the published site.
Step 4: Ask for a diagnosis before a fix
This is the single biggest habit change. Instead of "fix it", ask the AI to explain the cause first, without editing code. Most tools now have a mode for this: Lovable has Plan mode, which "investigates and plans without touching your code"; Bolt replaced its Discussion Mode with Plan Mode in August 2026; Claude Code and Cursor can be asked to plan or explain before editing. Lovable's guide suggests prompts like "What is the root cause of this build error?" and recommends asking "why did this happen?" rather than only "what do we do now?"
Step 5: Make the smallest possible fix
Once you agree with the diagnosis, ask for a minimal change. Big refactors are where new bugs come from. A good line to add to any fix prompt: "Fix this with the smallest possible change and tell me exactly which files and lines you changed." If the AI proposes rewriting half the app, ask it to propose the smallest change first.
Step 6: Verify it yourself
Re-run your steps from Step 2. Then check the things that were working before still work. The AI saying "I fixed it" doesn't count; it only counts once you've checked. If your project has automated tests, run them. Simon Willison, who writes widely about coding with AI agents, starts sessions on existing projects with a four-word prompt, "First run the tests", and argues that "automated tests are no longer optional when working with coding agents."
Step 7: Roll back if you're going in circles
If two or three attempts haven't helped, stop. Restore the last version that worked, then re-prompt with everything you learned: the exact steps, the error, and what didn't work. Lovable's guide lists reverting as a standard step when "fixes have tangled the code", and you can also edit an earlier message and choose "Revert and resend". Rolling back isn't failure. It's often the fastest route to a fix.
How to read an error (even if you don't code)

Most vibe-coded apps are web apps, so your best friend is the browser's developer tools. To open the console:
- Windows / Linux: press
F12(or right-click the page → Inspect) and click the Console tab. - Mac: press
Cmd + Option + Iand click Console.
Red lines are errors, yellow lines are warnings. You don't need to understand them. You just need to copy them accurately. A few tips:
- Reload the page with the console open so you catch errors that happen on load.
- Ignore errors from browser extensions. Ad blockers and other extensions can add noise. Testing in a private/incognito window with extensions off gives you a cleaner picture.
- Check the Network tab when data doesn't load. A failed request (often shown in red, with a code like 401, 403, 404 or 500) tells you whether the problem is your login, your permissions, a missing page or the server.
- Ask for a plain-English translation. Paste the error and ask the AI to explain it "like I'm not a programmer" before it fixes anything.
Here's a quick decoder for errors beginners hit most often:
| What you see | What it usually means | What to tell the AI |
|---|---|---|
| "X is not defined" / "Cannot read properties of undefined" | The code uses something that doesn't exist yet, often data that hasn't loaded | "Find where this value comes from and handle the case where it's empty or still loading." |
| Blank white page | A crash during load; the real error is in the console | Paste the first red console error in full. |
| 401 / 403 in the Network tab | Not logged in, or the database/API refuses access | "Check auth and database access rules for this request. Don't make the data public to fix it." |
| 404 | Wrong URL, route or file path | "This request returns 404. Check the route and the URL being called." |
| 500 | The server or a backend function crashed | Look at server/function logs in your tool and paste them. |
| CORS error | The browser blocked a call to another domain | "Explain this CORS error and fix it on the server side, not by disabling security." |
| Works in preview, fails when published | Missing environment variables, API keys or a different database | "List every environment variable and external service this app needs in production." |
| "Module not found" / build failed | A missing package, wrong import or a made-up function | "Check this package and function actually exist in the installed version." |
Notice the warnings in that table. When an AI "fixes" an access error by making data public or switching off a safety check, the bug disappears and a security hole appears. Lovable's docs make the same point: a quick fix "might silence an error without addressing the logic behind it." If your app handles logins, payments or personal data, run through our vibe coding security checklist after any fix in those areas.
Practice spotting what's wrong
Take the free two-minute Vibe Challenge and test your instincts on prompts, bugs and AI-built apps.
Debugging prompts that actually help
Good debugging prompts give the AI evidence and constraints. These templates work in any tool: Lovable, Bolt, Replit, Cursor, Claude Code or a plain chat assistant. For a wider prompt library, see vibe coding prompts that actually work.
1. The bug report prompt
// Use this instead of "it's broken, fix it" "There's a bug. Don't change any code yet. Steps to reproduce: 1) log in 2) open Bookings 3) click Save Expected: the booking appears in the list Actual: nothing happens and the form stays filled in Where: published site, Chrome on desktop (preview works fine) First console error (full text): [paste here] Explain in plain English what is most likely causing this, list 2–3 possible causes ranked by likelihood, and tell me how we can confirm which one it is."
2. The smallest-fix prompt
"Your diagnosis makes sense. Fix ONLY this bug with the
smallest possible change. Don't refactor, rename or restyle
anything else. Afterwards tell me:
- which files and lines you changed and why
- what else this change could affect
- 5 manual checks I should do to confirm it's fixed
and nothing else broke."3. The "what changed?" prompt
"This feature worked before my last few changes.
Compare the current version with the last working version
[or: the last commit / checkpoint] and list every change
that could affect [feature]. Which change most likely
broke it? Don't edit anything yet."4. The add-logging prompt (for bugs with no error)
"There's no error message, but the total shown on the
checkout page is wrong. Add temporary console.log lines
that show the values at each step of the calculation,
labelled clearly. Don't change the logic. I'll run it and
paste the output back to you."5. The fresh-start prompt (when a chat is going in circles)
// Paste into a NEW chat after rolling back "Context: [one paragraph describing the app and stack]. Goal: [the feature that should work]. We already tried: [fix A] and [fix B]; neither worked because [what happened]. Here is the error and the relevant file: [paste]. Propose a different approach than the ones above. Plan first, then wait for my OK."
Two extra tricks from experienced developers: ask the AI to explain the code it just wrote before you accept it, and ask for two or three alternative solutions when one approach keeps failing (both suggested by Andrew Stellman in O'Reilly Radar). Comparing options often exposes the real problem.
Built-in debugging tools in popular vibe coding apps
You don't have to debug from scratch. The main app builders have rescue features, but they work differently. (For a full comparison of these tools, see Lovable vs Bolt vs Replit; for editor-based agents, see Cursor vs Claude Code.)
Lovable
A "Try to fix" button appears when a build error shows up. Lovable's docs say accounts include 10 free fixes, each available again 24 hours after use; after that, fixes use credits. Plan mode investigates without editing code (a Plan message costs one credit, per the docs). Version history lets you revert or preview older versions without reverting.
Replit
The Agent creates checkpoints automatically, including before attempting fixes for critical issues. "Rollback to here" in the Agent tab restores files, AI context and more. By default, rollbacks don't change your database; you have to tick the database option, and production databases use a separate restore.
Bolt
Plan Mode (which replaced Discussion Mode in August 2026) lets you talk through a problem before changes are made. Paid plans include a security audit in the Publish menu; a database Security tab is available on any plan.
Cursor, Claude Code & others
These work on real files in your project, so Git is your undo button. Commit before each fix, ask the agent to run the tests first, and review the diff (the list of changed lines) before accepting.
Rolling back code doesn't always roll back data. Replit's docs say rollbacks leave your database alone unless you choose otherwise. In July 2025, Fortune reported that a Replit agent deleted a live database during a "code and action freeze" for SaaStr founder Jason Lemkin; Replit's CEO called it "unacceptable" and added safeguards like automatic dev/prod database separation. Lesson: keep test data and real data separate, and back up before letting an AI touch either.
The doom loop: when to stop prompting

Every vibe coder hits a point where more prompting makes things worse. Watch for these signs:
- The same error keeps coming back after "fixes".
- Fixing one thing breaks another feature.
- The AI starts rewriting large parts of the app for a small bug.
- The AI apologises, says it's fixed, and nothing has changed.
- You've spent more credits on the bug than on building the feature.
When you see two or more of these, use this escape plan:
- Stop sending fix prompts. Lovable explicitly advises switching to Plan mode after one or two failed attempts because it's "usually faster than trying again".
- Roll back to the last version where the feature worked (or the version before you started the feature).
- Isolate the problem. Lovable's guide suggests building "a fresh, minimal version of just that component" and then reintegrating it. Test the broken piece on its own.
- Start a fresh chat with a short summary (prompt 5 above). Long chats accumulate confusion.
- Change the angle. Ask the AI to check the data flow first, or to list the assumptions the code makes. Many "random" bugs are broken assumptions.
- Get a second pair of eyes if the bug involves payments, logins or personal data, or if you've lost more than a day. Rather have it fixed for you? Our hire a vibe coder page is for exactly that, and our guide to hiring a vibe coding developer explains what to ask anyone you bring in.
Debugging published apps
Some bugs only appear after you publish. The usual suspects:
- Missing environment variables. API keys and settings that existed in the preview aren't set in production. Check your host's settings and never paste secret keys into front-end code.
- Old version still live. On several platforms, edits don't go live until you publish or update again. Confirm the live site is actually running your latest version.
- Database rules. A different database, or stricter access rules, can make data vanish or requests fail with 401/403.
- Domains and redirects. Login providers and payment services often need the live domain added to an allowed list.
Our step-by-step guide to deploying a vibe-coded app covers secrets, environment variables and common deploy errors in detail.
Prevent bugs before they happen
The best debugging is the bug you never ship. These habits make vibe-coded apps far easier to fix:
| Habit | Why it helps |
|---|---|
| One feature per prompt | When something breaks, you know which change did it. |
| Test after every change | Bugs are cheapest the moment they appear. Replit's docs recommend testing after each major checkpoint. |
| Save working versions | Checkpoints, version history or Git commits give you a safe place to return to. |
| Ask for tests | "Write a simple test for this feature" gives you an automatic check. If tests are hard for the AI to write, Stellman notes, that's a signal to stop and think about the design. |
| Plan before big features | A short plan catches misunderstandings before they become code. |
| Keep real data separate | Experiment on test data so a bad fix can't wipe real users' information. |
| Ask "explain this" regularly | Understanding even part of your code makes every future bug easier. |
That last habit matters more than it sounds. In Anthropic's January 2026 randomized study of 52 mostly junior engineers learning a new Python library, the group using an AI assistant scored 50% on a follow-up quiz versus 67% for the hand-coding group, and the largest gap was on debugging questions. The lowest scorers tended to delegate to the AI and rely on it for iterative debugging; higher scorers asked conceptual questions and made sure they understood the generated code. We cover that research in vibe coding vs learning to code. The takeaway for debugging: let the AI do the typing, but make sure you understand the cause of each bug it fixes.
A worked example: the disappearing bookings
Here's how the loop plays out on a typical (illustrative) beginner bug. Maya has vibe-coded a booking app for her yoga classes. In the preview, bookings save fine. On the live site, clicking Save does nothing.
- Save state: she notes the current version in version history.
- Reproduce: log in → Bookings → fill the form → Save. Expected: booking appears. Actual: nothing; form stays filled.
- Evidence: console shows a red error, and the Network tab shows the save request failing with 403.
- Diagnose: she pastes everything with the bug report prompt and asks for causes without edits. The AI suggests the live database's access rules don't allow logged-in users to insert bookings.
- Smallest fix: she asks for a rule that lets each logged-in user create only their own bookings, and explicitly says "don't make the table public".
- Verify: booking saves; she logs in as a second test user to confirm they can't see the first user's bookings.
- Prevent: she asks for a short checklist of other tables that might have the same problem.
Total prompts: about four. Compare that with ten rounds of "it still doesn't work, fix it".
Want low-stakes practice? Build something tiny with the Vibe Machine idea generator, break it on purpose, and debug it with the loop above. Or play the nine free games in the Vibe Arcade to see what small vibe-coded apps look like. Picking a tool first? Browse our tools directory, and see more vibe coding examples for real projects and what went wrong in them.
Frequently asked questions
How do I debug a vibe-coded app?
Reproduce the bug with clear steps, copy the exact first error from the browser console, describe expected versus actual behavior, ask the AI for the root cause before it edits code, apply the smallest fix, then test it yourself. If two fixes fail, roll back to the last working version and re-prompt.
Why does the AI keep breaking my app when it fixes bugs?
Vague "fix it" prompts let the AI guess, and each guess changes more code. Repeated blind fixes can pile up code that hides the real problem. Ask for a diagnosis first, request the smallest possible change, and work on one bug at a time.
How do I open the browser console?
On Windows or Linux press F12 (or right-click the page and choose Inspect), then open the Console tab. On a Mac press Cmd + Option + I. Red lines are errors; copy the first one in full and paste it to your AI tool.
What should I do when the AI gets stuck in a loop?
Stop prompting for fixes. Roll back to the last working version, start a fresh chat with a short summary of the app, the bug and what you already tried, and ask for a different approach with a plan first. Isolating the broken part in a minimal version also helps.
Is it better to roll back or keep fixing?
If one or two fix attempts haven't worked, rolling back is usually faster. Restore the last version where the feature worked and re-prompt with everything you learned. Remember that in some tools, like Replit, rolling back code doesn't roll back your database by default.
Does Lovable's "Try to fix" button cost credits?
According to Lovable's docs, accounts include 10 free fixes, each becoming available again 24 hours after you use it; after that, Try to fix is treated as standard build usage and uses credits. Lovable recommends using it once or twice, then switching to Plan mode.
Why does my app work in preview but not when published?
Common causes are missing environment variables or API keys, a different production database with stricter access rules, an old version still being live, or login and payment services that haven't been told about your live domain. Check the console and Network tab on the live site.
Do I need to learn to code to debug AI-generated code?
No, but a little understanding goes a long way. You can debug effectively by gathering evidence and guiding the AI. Asking the AI to explain causes and code in plain English builds the skills that make future bugs easier to solve.
Can an AI fix create security problems?
Yes. An AI may "fix" an access error by making data public or disabling a safety check. Veracode's 2025 research found security flaws in 45% of AI-generated code samples tested. Always check fixes that touch logins, databases, payments or personal data.
When should I get help from a developer?
Get help when a bug involves payments, logins or personal data, when you've lost more than a day going in circles, or when fixes keep breaking other features. A developer can review the code, add tests and fix the root cause.
Keep reading
More guides on the Vibe Coding blog.
Sources
- Lovable Docs, "Debug and improve your app" (checked Nov 18, 2026): docs.lovable.dev
- Lovable Docs, "Work with Lovable in the project chat" (Plan mode, Try to fix, reverting; checked Nov 18, 2026): docs.lovable.dev
- Replit Docs, "Checkpoints and Rollbacks" (checked Nov 18, 2026): docs.replit.com
- Andrew Stellman, "Trust but Verify", O'Reilly Radar, Sept 24, 2025: oreilly.com
- Dyad, "Top prompts for fixing vibe-coded apps", Jan 30, 2026: dyad.sh
- Ray, "30 Days of Vibe Coding | Day 12: A Debugging Workflow for Vibe Coding", Sept 25, 2026: israynotarray.com
- Simon Willison, "First run the tests", Agentic Engineering Patterns, 2026: simonwillison.net
- Andrej Karpathy, "Vibe coding MenuGen", Apr 27, 2025: karpathy.bearblog.dev
- Veracode, 2025 GenAI Code Security Report press release, July 30, 2025: veracode.com
- Fortune (Beatrice Nolan), Replit AI agent deletes database, July 23, 2025: fortune.com
- Anthropic, "How AI assistance impacts the formation of coding skills", Jan 29, 2026: anthropic.com
VibeCodingMeaning.com is an independent educational site and isn't affiliated with any tool mentioned. Tool features and credit rules change often; check each tool's site for current details. The yoga booking example is illustrative.