When Things Break: An AI Coder's First-Aid Guide | SheCodes
Beginner 5 min read

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

Take a breath. Your project is okay.

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.

“My page is completely blank or white” 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?"
“I see a scary error screen” 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?"
“My site looks fine locally but broken when deployed” 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]."
“I accidentally deleted something important” 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.
“AI keeps making changes that break other things” 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.

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. 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. 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. 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. 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. 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

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.”

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.

Ctrl+Z (or Cmd+Z on Mac) 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.
Ask AI to revert 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.
Git checkout (via your AI tool) 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."
Git stash (via your AI tool) 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."

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.

Save your progress often 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.
Test after every single change 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.
Change one thing at a time 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.
Keep your AI instructions focused Instead of "rebuild the whole page," say "change just the header background color." Small, specific requests lead to fewer surprises.
Write down what is working 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.

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.