Blog · 7 min read
How to fix a broken vibe-coded app without making it worse.
By the Obra Insights team ·
Every vibe coder knows this loop. Something breaks. You ask the AI to fix it. It fixes that and breaks two other things. You ask again. An hour later the app is worse than when you started, and you're not sure which of the last twenty changes caused it.
The way out isn't a better prompt. It's a better process. Here's the one we use on rescue jobs, adapted so you can do it yourself.
Step 1: Freeze and save a checkpoint
Stop prompting. Commit everything as it is right now, broken or not, with a message like checkpoint before fix. If your project isn't in Git yet, connect it to GitHub today. Lovable, Bolt, and Replit can all sync to a repo.
One caution: if your tool syncs both ways with GitHub, decide which side is the source of truth before you edit anywhere else. Editing the repo by hand while the AI tool keeps its own copy is how people lose a week of work.
Then find the last version that worked. Most tools keep a version history; Git has git log. Knowing the last good point turns "everything is broken" into "something changed between Tuesday and today."
Step 2: Write down exactly what's broken
Vague problems get vague fixes. For each issue, write three lines:
- What I did: "Logged in as a new user and clicked Save on the profile page."
- What I expected: "Profile saves and shows a success message."
- What happened: "Spinner forever. Console shows 403 on
/rest/v1/profiles."
That last line matters. Open the browser console and the network tab, reproduce the bug, and copy the first error. Ninety percent of the diagnosis is in that one message.
Step 3: Rank the problems, then fix one at a time
Sort your list by severity. Our order is: security issues first (anyone can read other users' data, keys exposed), then anything that blocks signup, login, or payment, then broken features, then cosmetic issues.
Then give the AI exactly one problem per conversation. A good fix prompt looks like this:
Bug: [the three lines from step 2]. Error: [the first console error]. Relevant file: [path]. Before changing code, list the 3 most likely root causes and tell me how to confirm each one. Change only what's needed for the confirmed cause.
Asking for causes before code stops the assistant from rewriting half your app on a guess.
Step 4: The two-strike rule
If a fix doesn't work, revert it before trying the next idea. If two fixes in a row fail, stop and add logging instead of more changes: print the values going in and out of the function that's failing. Stacking failed fixes on top of each other is the single biggest reason vibe-coded apps spiral.
Step 5: Check the usual suspects
Most broken AI-built apps we look at have at least one of these:
- Row Level Security off or too open. In Supabase, every table that holds user data needs RLS enabled and policies that limit rows to their owner. A policy of
USING (true)means anyone can read everything. - Roles checked in the browser. Hiding the admin button isn't security. Check roles on the server or in the database policy, not in
user_metadatathe user can edit. - Secrets in the frontend. Search your built JavaScript for
sk_live,service_role, orsk-. If they're there, move those calls to a server function and rotate the keys. - Missing environment variables in production (see our deploy checklist).
- Webhooks that trust the success URL instead of a verified Stripe event.
Step 6: The two-user test
This takes sixty seconds and catches the most dangerous bug in vibe-coded apps. Sign up as User A and create something. Open a private window, sign up as User B, and try to view or edit User A's item, either through the UI or by replaying A's network request. If B can see A's data, fix that before anything else.
Step 7: Verify, then lock it in
After each fix, reproduce the original steps and confirm the bug is gone. Then click through signup, login, the main feature, and payment to make sure nothing else broke. Commit with a clear message (fix: profile save 403, add owner RLS policy). Small, labeled commits make the next bug much easier to find.
If you can, turn the bug into a quick test or a line in a checklist so the next "quick fix" from your assistant doesn't quietly reopen it.
When it's time to get help
Bring in a second pair of eyes if you've spent more than a day on the same bug, if the problem involves other people's data or money, or if every fix creates a new problem. Sometimes the honest answer is that a section needs rebuilding, and it's better to know that early.
Our Health Scan does the steps above for you: a severity-ranked report with evidence, and fixes delivered as pull requests you approve. Start with the free scan to see what turns up.