You spent a weekend with Cursor, ChatGPT, or Lovable and built something that actually worked. Login flow, database, the whole thing. Then you changed one thing and the entire app fell apart. Sound familiar?
This happens more often than you'd think. Vibe coding tools are great at generating code that looks right, but they don't always understand the full picture of your app. One small change can create a chain reaction of bugs because the AI didn't build with long-term structure in mind.
Here's how to approach fixing it without starting over.
Step 1: Don't Panic, Read the Errors
This sounds obvious, but most people skip it. When your app breaks, the error messages are your best friend. Open your browser console (right-click, Inspect, Console tab) or your terminal if it's a backend issue.
What to look for:
- The first error in the stack trace, not the last one. Errors cascade, and the root cause is usually at the top.
- File names and line numbers. These tell you exactly where things went wrong.
- Keywords like
undefined,null,TypeError, orCannot read properties. These almost always mean a variable isn't what the code expects it to be.
Tip: Copy the full error message and paste it into Google or ChatGPT. You'll often find the exact fix within the first few results.
Step 2: Figure Out What Changed
If you're using Git (and you should be), run git diff to see exactly what changed since the app last worked. If you're not using Git, try to remember what you modified last. The bug is almost certainly in that change or something connected to it.
Common culprits after a vibe coding session:
- Environment variables that got deleted or renamed
- Package updates that introduced breaking changes
- Database schema changes that don't match your code anymore
- Authentication tokens that expired while you were building
- API endpoints the AI generated that point to the wrong URL
Step 3: Isolate the Problem
Don't try to fix everything at once. Narrow it down to the smallest piece that's broken.
If the whole app won't start: Check your package.json scripts, environment variables, and make sure all dependencies are installed. Run npm install or yarn again. You'd be surprised how often this alone fixes things.
If one feature is broken: Comment out the broken code and make sure the rest of the app still works. Then add things back piece by piece until you find the exact line causing the issue.
If it works locally but not in production: Check your build logs, environment variables on your hosting platform, and make sure your database connection strings are correct for production.
Step 4: Check the AI's Assumptions
AI-generated code makes assumptions about your setup that might not be true. Here are the ones that trip people up the most:
- Hardcoded URLs: The AI might have used
localhost:3000somewhere instead of your actual domain. - Missing error handling: AI code often assumes everything succeeds. When an API call fails, there's no fallback, so the entire page crashes.
- Wrong imports: The AI sometimes imports from packages you don't have installed, or uses the wrong version of an API.
- State management bugs: If you're using React or similar, the AI might be mutating state directly instead of using proper setters, causing the UI to not update.
Step 5: Know When to Ask for Help
If you've been stuck for more than a few hours, you're past the point of diminishing returns. The code the AI generated might have deeper structural issues that aren't obvious from the error messages alone.
Signs it's time to bring in a professional:
- You're fixing one bug and creating two new ones
- The AI keeps suggesting the same fix that doesn't work
- You don't understand the codebase well enough to know what's safe to change
- There's user data involved and you're not sure it's secure
There's no shame in it. You had an idea, you built a prototype, and now it needs a professional's touch to get it across the finish line. That's actually a smart way to build.
Stuck on a broken vibe coded app?
Send me a message with what's happening. I'll take a look and tell you exactly what it'll take to fix it.
Email David