What Do You Do When Each AI Fix Breaks Something Else?
Stop after two failed attempts. Go back to the last version that worked, work out the cause without changing code, then start a fresh session with a smaller request. More fixes on top of a wrong diagnosis add code that hides the real problem, so going back is usually faster than pushing on.
Stop. Don't change any code. We've tried to fix this [number] times and it's not working. 1. List each fix we tried, what it changed, and whether that change is still in the code. 2. Which assumption did those fixes share? What if it's wrong? 3. Compare the last working version ([commit or checkpoint]) with the current code. Which changes could cause this? 4. Which of those changes should we undo, whichever way this turns out? 5. Give me one way to find the cause that doesn't change behavior, such as a log line or a query that only reads. 6. Recommend: go back to the working version and redo the feature in smaller steps, or fix forward. Explain why, and tell me if any database change affects that choice. If you don't know the cause, say so. Don't guess, and don't propose another fix yet.
- 1Two failed attemptsStop here, before a third fix
- 2Go backReturn to the last working version
- 3Check the dataCode undo often leaves database changes
- 4Find the causeAsk why, with no code changes
- 5Start fresh, ask smallerRebuild in small, tested steps
Try it now
- 1Stop the tool: Stop in Replit's Agent panel, or
Escin Claude Code. If it's frozen, don't send more messages. Replit says extra prompts can give Agent conflicting instructions. - 2Find your last working version: History in Lovable with Revert,
/rewindin Claude Code, a restored checkpoint in Cursor, or Rollback to here in Replit. - 3Paste the prompt above, then start a new session with what you learned and a smaller request. It worked if you've got a clear cause or a clean version to rebuild from, rather than attempt number five.
Use it when
When the same error returns, the AI repeats a fix you've rejected, a fix breaks a feature that used to work, or you've stopped understanding what it's doing.
Skip it when
Don't roll back if the database changed in between, until you've checked what that would do. Rolling back code while the data stays changed can create a new problem. And if each attempt is making real progress toward a clearer error, it isn't a loop yet, so keep going.
Why it works
Vendors say almost exactly the same thing here. Lovable's docs say that switching to Plan mode after one or two failed attempts is usually faster, and that rewinding is often faster than untangling. Anthropic's Claude Code guide says that after two failed corrections, you should run /clear and write a better prompt, because a third correction adds to a conversation already full of failed attempts. Replit's help says to select Stop, run Restart compute, and start a new chat with a more specific prompt.
Each failed fix also leaves code behind that the next attempt has to work around, so the problem grows. The loop can cost real money too. Replit bills by effort and recommends a usage limit so a loop can't run up a large bill, and Lovable's Try to fix gives you 10 free fixes that come back after 24 hours, so spending them on a wrong diagnosis has a cost.
Example
You add a search box, and the dashboard stops loading. Three fixes later, the search works but sign-out is broken, and there's a new helper file nobody asked for. You stop. In Lovable, you open History, find the last good version and select Revert, then tell Lovable what you did so it has the context, as its docs suggest.
In Plan mode, you ask why the dashboard broke. The answer: search loaded every record on page load. You rebuild it as two small steps, testing after each. Your database didn't change, so reverting was safe. Had the attempts included a migration, you'd have checked that first.
Going further
Know exactly what "undo" covers in your tool, because data is usually left out:
- Lovable: Revert restores code and redeploys edge functions. Data changes stay.
- Replit: a rollback restores your development database only if you tick Database. The production database needs a point-in-time restore.
- Claude Code: checkpoints don't cover files changed by shell commands, so keep using Git.
- Cursor: restoring a checkpoint rolls back files and keeps the chat.
- Vercel: Instant Rollback moves your domains to an older build, and leaves environment variables and databases alone.
If you don't know which change caused the bug, git bisect can find it by testing commits between a good and a bad version. Ask the AI to walk you through it, using your test as the check. This is much quicker when your commits are small, which is another reason for slices.
Common mistakes
- Saying "try again" or "still broken" with no new information. This usually gets another version of the same guess.
- Reverting code without checking whether the failed attempts also changed the database.
- Keeping the fix-attempt code "just in case". It's often the next bug.
- Having no saved version to go back to, because you never committed during the good stretch.
Sources
- Debug and improve your app, Lovable docs
- Project history, Lovable docs
- Best practices, Claude Code docs
- Agent and AI help, Replit docs
- Checkpoints and rollbacks, Replit docs
- AI billing, Replit docs
- Agent overview, Cursor docs
- Instant Rollback, Vercel docs
Checked 6 November 2026. Products change often, so confirm details with the vendor.