It happens to everyone. Here's how to stay calm and fix it.
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.
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.
What's probably happening
Something in your code crashed before the page could finish loading. Think of it like a recipe where one step failed, so the whole dish never made it to the table. The page is still there — it just can't show itself right now.
What to do
Open your browser's console (press F12, then click "Console") and look for red text. Copy that red text and paste it to your AI tool. Say: "My page is blank. Here's the error from the console: [paste]. What went wrong?"
What's probably happening
That big ugly error screen is actually trying to help you. It is your app telling you exactly what went wrong, like a car dashboard light. It looks intimidating, but it contains the clue you need to fix things.
What to do
Do not panic. Copy the error text (especially the first line or two) and paste it to your AI tool. Say: "I see this error on my screen: [paste]. I don't understand it. What went wrong and how do I fix it?"
What's probably happening
Your site works on your computer because it has access to things (like secret keys or special settings) that the live server does not have. It is like packing for a trip but forgetting your toothbrush — everything was fine at home, but not when you arrived.
What to do
Check your hosting dashboard (like Vercel) for build logs — they will show what failed. Common culprits: missing environment variables, or code that works in development but not in production. Tell your AI: "My site works locally but not when deployed. Here are the build logs: [paste]."
What's probably happening
If you are using Git (and you should be!), your code has a safety net. Git remembers every version of every file you have saved. Think of it like an undo button with unlimited history. Your deleted code is almost certainly still there.
What to do
Tell your AI tool: "I accidentally deleted [file or code]. Can you help me get it back using Git?" If you have not set up Git yet, check your editor's local history — most editors keep recent versions of files automatically.
What's probably happening
Your AI tool is trying to help, but it does not always remember the full picture of your project. When you ask it to fix one thing, it might accidentally change something else. It is like asking a house painter to fix one wall and they repaint the whole room a different color.
What to do
Start a fresh conversation with your AI tool. Be very specific: "Only change [this one file]. Do not modify anything else. Here is what I need fixed: [describe the problem]." The more focused your instructions, the less it will wander.
No matter what went wrong, these five steps will get you moving in the right direction. Follow them in order.
Red text is a clue, not a punishment. The first line usually tells you exactly what went wrong. Read it slowly.
Select the error text, copy it, and paste it somewhere. Do not try to retype it or summarize it — the exact words matter.
Paste the error and explain what you were doing when it happened. The more context you give, the better the fix will be.
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.
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.
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
When you need to go back
"Undo the last change you made. It broke [describe what stopped working]. Please revert it."
You see an error you don't understand
When you see a confusing error
"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
When you need to retrace your steps
"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
When you need AI to focus
"Don't change anything else. Only fix [describe the specific problem]. Do not modify any other files or features."
You are completely lost
When you need a lifeline
"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."
You do not need to memorize commands. Just know that these options exist, and ask your AI tool to do them for you.
Undo your last edit in your code editor
You just made a change and immediately see something is wrong. Keep pressing it to undo more changes.
Tell your AI tool to put things back the way they were
Your AI tool made a change that broke something. Say: "Undo the last change you made, it broke [thing]." Works in Claude Code, Cursor, and similar tools.
Restore a file to its last saved version
You changed a file and want to throw away all unsaved changes. Tell your AI: "Restore [filename] to the last committed version using Git."
Temporarily set aside your recent changes
You want to save your experiment but go back to a clean state for now. Tell your AI: "Stash my current changes so I can come back to them later."
The most important thing: you do not need to know how Git works under the hood. Just tell your AI tool what you want to undo, and it will handle the details. For example: "I want to go back to how my project was an hour ago."
The best way to deal with things breaking is to make them break less often. These habits will save you hours of stress.
After every change that works, tell your AI tool to commit it with Git. Think of commits like save points in a video game. The more you have, the less you can lose.
Made a change? Check your browser immediately. Do not make five changes and then check. If something breaks, you will know exactly which change caused it.
Do not ask your AI tool to add a new feature, change the colors, AND fix a bug all at once. Do them one at a time. If something breaks, you will know why.
Instead of "rebuild the whole page," say "change just the header background color." Small, specific requests lead to fewer surprises.
Before making big changes, take a mental note (or a screenshot) of what your site looks like when it is working. This makes it easier to explain what changed if something goes wrong.
Remember: breaking things is not failure. It is how you learn. Every problem you fix makes you a better builder.