Skip to content
>_VibeUnstuck

Guide

How to break the AI fix loop

The loop starts when a tool “fixes” an error by editing more code than the error asked for. The app breaks somewhere else. You paste the new error. The same file gets rewritten. After a few rounds the diff is larger than the bug.

What the loop looks like

You can spot it without reading the model’s reasoning.

  • The same file is in the diff three times, and none of those versions are committed.
  • The new error is in code the model added to silence the old error.
  • Typecheck, lint, or Row Level Security was turned off “just for now”.
  • A secret moved into a NEXT_PUBLIC_ or VITE_ variable so the browser could call the API.
  • The model says it should work, and you have not run the app.

Stop, then get back to a known state

Do not send another “fix it” message. If you use git, commit or stash before the session, then restore the last version that ran. In Cursor that is often the previous checkpoint. In Lovable or Bolt, use the editor’s history and restore the version before the loop, not the latest one.

A red error on a small diff is a better place to work than a green chat on a pile of unreviewed edits. You can always re-apply a good idea. You cannot always remember which of six rewrites still had the working query.

Read one error

Copy the first error, not the last line of a stack that says “caused by” something unrelated. The first message names the rule that failed: a Postgres policy, a missing module, a hostname, a signature.

Search that sentence here before you ask the model to invent a theory. The pages are written so the prompt at the bottom already includes the constraint the model usually ignores, such as “do not disable RLS” or “do not parse the Stripe body as JSON before you verify it”.

Search the library

One change, then run it

Ask for a diagnosis and a single change. Apply it. Run the same command or click that failed. If it still fails, the new error is data. If a different file broke, revert that change instead of patching forward.

Verification is the command, the request in the network panel, or the SQL result. A sentence from the model is not verification.

Patches worth refusing

  • Empty catch blocks, or catch { } that only logs and continues.
  • any, @ts-ignore, or turning off strict to make an import compile.
  • npm install --legacy-peer-deps or --force before anyone has read the peer dependency line.
  • Disabling Row Level Security, or shipping the Supabase service role key in the browser.
  • Putting Stripe, OpenAI, or database passwords behind NEXT_PUBLIC_ or VITE_.
  • next/dynamic with ssr: false on the whole page to hide one window crash.
  • mode: "no-cors". The browser still will not let you read the response.

When to leave the chat

If two attempts disagree about the cause, open the docs for the product named in the error. Supabase, Stripe, Next.js, and Vercel errors are specific. A generated explanation that never mentions the status code or the policy name is a guess.

Paste less. The error, the file that throws, and what you already tried is enough. The whole repository in the prompt makes the model “clean up” files that were fine.

Prompt to paste back into your AI tool

Paste this above the error.

Stop editing. Do not change files yet.

The latest error is:
<paste the full error here>

The last change you made was in:
<file>

1. Explain the cause in plain English, in under 80 words.
2. Name the single file you want to change and why the other files should stay untouched.
3. Tell me how I will verify it (the command or the click).
4. If your last two attempts touched this same file, say so and start from a different cause.

Do not disable typecheck, lint, RLS, or auth. Do not swallow the error in an empty catch. Do not add NEXT_PUBLIC_ to a secret. Wait for me to say "apply" before writing code.