How to Rescue a Lovable 2 Project Stuck in a Prompt Loop
A Lovable 2 project stalls when the same prompt keeps producing the same bad component. More prompts make it worse — each rewrite consumes 2 to 6 credits and drifts the code further from something you can reason about. The way out is rollback first, then one scoped fix at a time.
I recovered a six-screen dashboard that had burned 40 credits in a single afternoon. The routine below took five prompts.
How do you tell a loop from a slow build?
Loops have a signature: the change you asked for appears and then disappears in the next version, or the diff touches files you never mentioned. Slow builds just take longer to appear.
Open the version history and compare two consecutive versions. If the second one reverted your last accepted change, you are in a loop. Stop prompting at that point — every further prompt is spent on a moving target.
Step 1: roll back to the last good version
Pick the version before the loop started, not the most recent one that looks half right. A half-right version carries the bad structure that caused the loop.
Rollback is instant and free. Accept the rollback even though you lose later work; redoing two good prompts costs less than fighting six bad ones.
Step 2: freeze the working parts in a notes file
List the components that work, by file path if you can see the repo. Something like:
src/pages/Dashboard.tsx— layout is correct, do not rewritesrc/components/RenewalTable.tsx— sorting works, columns are wrongsrc/lib/supabase.ts— client setup, never touch
The list is for you, and it goes into the next prompt as an explicit constraint.
Step 3: send one narrow prompt with an exclusion clause
A prompt that works after a rollback in Lovable 2:
Only edit
src/components/RenewalTable.tsx. Change the column order to Account, Renewal date, Owner, Annual value, Status. Do not modify any other file, do not change styling, do not touch the Supabase client.
Naming the file and the exclusion is the difference between a 1-credit edit and a 6-credit rebuild. The model rewrites what it can see; narrowing the visible scope narrows the rewrite.
Step 4: verify before accepting, not after
Check three things in the preview before you hit accept:
- The thing you asked for changed.
- Something else did not change — spot-check the header and one other page.
- The Supabase console shows no new table or column.
Step three catches a surprising number of silent schema edits. A prompt about a “status field” can create a new status_v2 column instead of using the existing one.
Step 5: when to stop prompting and export
Two signals: the same screen has been re-prompted more than four times, or you find yourself describing CSS values. Both mean the prompt interface has hit its limit for that component.
Export the repo, fix the component in a normal editor, and push. Lovable works with a connected GitHub repo, so the app keeps deploying while you edit externally. This is not a defeat — it is the intended escape hatch.
What are the usual causes?
- Conflicting instructions across screens. “Make the table compact” from an earlier prompt fights “add spacing” later.
- A component duplicated under two names. Both get edited, one wins, the other resurrects.
- Auth state changing under the AI. If your Supabase session refreshes mid-session, the generated code may assume a different user shape.
- Very large pages. Above roughly 300 lines in one file, edits start touching unrelated sections.
Who this routine is for
Anyone past their first ten prompts on a project. If you are on the free plan with 5 credits a day, a loop costs you a day — rollback discipline is not optional there.
If your project is a throwaway prototype, skip all this and start a fresh project. Rolling back takes less time than a clean rebuild only when the working parts are worth keeping.
Quick Summary
- A loop shows as the requested change appearing then reverting in the next version — stop prompting when you see it.
- Roll back to the version before the loop, not the latest half-right one; rollbacks are free.
- Send one prompt naming a single file and an explicit “do not touch” list.
- Verify the Supabase schema after each accept; prompts about fields often create duplicate columns.
- After four failed attempts on one screen, export to GitHub and edit in a normal editor.
