When Things Break: An AI Coder's First-Aid Guide
It happens to everyone. Here's how to stay calm and fix it.
In this chapter
- What to do when your page is blank or your site won't load
- How to stay calm when AI keeps making things worse
- Step-by-step recovery for the scariest moments
- When to undo, when to ask AI, and when to start over
Rule #1: Don't Panic
Every single person who builds websites breaks things. Professional developers break things every day. It is a completely normal part of the process, not a sign that you did something wrong.
Your code is not gone. Your site is not ruined. Whatever happened can almost certainly be fixed or undone. The tools you are using (Git, your code editor, your AI tool) all have built-in safety nets.
The most important skill when things break is not technical. It is staying calm enough to read the error message and ask for help clearly. That is what this guide will help you do.The 5 Scariest Moments
These are the moments that make beginners want to close their laptop and walk away. But each one has a simple explanation and a clear fix.
The Universal Fix Checklist
No matter what went wrong, these five steps will get you moving in the right direction. Follow them in order.
Your step-by-step plan
-
1
Read the error message Red text is a clue, not a punishment. The first line usually tells you exactly what went wrong. Read it slowly.
-
2
Copy the EXACT error message Select the error text, copy it, and paste it somewhere. Do not try to retype it or summarize it. The exact words matter.
-
3
Tell your AI tool what happened Paste the error and explain what you were doing when it happened. The more context you give, the better the fix will be.
-
4
If AI goes in circles, start fresh If your AI tool keeps suggesting the same thing and it is not working, open a brand new conversation. Give it the full context from scratch.
-
5
If all else fails, go back to the last working version Use Git to undo your recent changes and get back to when everything was working. You can always try again from a clean starting point.
Magic Phrases for Your AI Tool
When you are stressed, it is hard to think of what to say. Here are ready-to-use prompts you can copy and paste directly into Claude Code, Cursor, or whatever AI tool you use. Just fill in the [brackets] with your details.
Something just broke
“Undo the last change you made. It broke [describe what stopped working]. Please revert it.”
You see an error you don't understand
“I see this error: [paste the error]. I don't understand it. What went wrong and how do I fix it? Please explain in simple terms.”
Things were working before
“Stop. Let's go back to when [describe what was working] was working correctly. What changed since then? Walk me through it step by step.”
AI keeps changing too many things
“Don't change anything else. Only fix [describe the specific problem]. Do not modify any other files or features.”
You are completely lost
“I'm stuck and confused. Here is what my app is supposed to do: [describe your goal]. Here is what is happening instead: [describe the problem]. Here is the error I see: [paste error]. Please help me fix just this one thing.”
How to Undo Anything
You do not need to memorize commands. Just know that these options exist, and ask your AI tool to do them for you.
Prevention Tips
The best way to deal with things breaking is to make them break less often. These habits will save you hours of stress.
Frequently Asked Questions
My entire page is blank. What happened?
Usually a JavaScript error is crashing the page before it can render. Open your browser's developer tools (F12) and check the Console tab for red error messages. Copy the error and paste it to your AI tool. It can almost always fix it.
I made a change and now everything is broken. How do I undo it?
If you're using Git, run 'git diff' to see what changed, or 'git stash' to temporarily undo your changes. If you're not using Git yet, most code editors have a local history feature. Right-click the file and look for 'Local History' or 'Timeline'.
My app works on my computer but not when I deploy it. Why?
The most common reasons: missing environment variables on the hosting platform, a dependency that works locally but isn't installed in production, or hardcoded 'localhost' URLs. Check the deployment logs for the specific error.
How do I know if the problem is my code or the AI's code?
It doesn't matter. It's all your project now. What matters is fixing it. Copy the error message, paste it to your AI tool with context about what you were trying to do, and let it help you debug. That's the workflow.