Debugging
Something broke and you don’t know why? Make it happen again and read the error in your browser or your logs. Then tell your AI tool where it broke, what you see and how you’ll know it’s fixed.
Do I need to learn debugging if my AI tool writes the code?
Yes, a little. Your AI tool does most of the fixing, but it can’t see your screen or your dashboards. Your part is to make the bug happen again, find the error, and describe it clearly.
Words: Bug, AI coding tool
How do I make a bug happen again on purpose?
Find the exact steps that cause it every time, because a fix you can’t test is only a guess. Write the steps down. They become your test once your AI tool says it’s done.
- If it happens every time
- Write each click and what you typed, from opening the page to the moment it breaks.
- If it happens only sometimes
- Note what was different: signed in or out, phone or laptop, your computer or the online version. Try each one until you find the difference.
- If it breaks only after you put it online
- That usually means a setting, not the code. Start with “Why does my product work on my computer but not online?”.
What’s the fastest way to fix a bug with my AI tool?
Tell it three things: where it happens, what you see, and how you’ll know it’s fixed. Paste the full error instead of describing it. Then ask it to find the cause before it changes anything.
- Where it happens
- The page or screen, and the steps to get there. “On /signup, after I type an email and click Create account.”
- What you see
- What happened instead of what you expected, plus the error copied from the Console, the Network tab or your logs.
- How you’ll know it’s fixed
- Something you can check yourself. “I land on /dashboard and my name shows at the top.”
- Get better at asking
- Plan with your AI tool, check its work and keep chats short. Working with an AI agent
Words: Error message
How do I see errors in my browser?
Open your browser’s developer tools. The Console tab shows errors from the code running on the page. The Network tab lists every request the page makes, with a status code for each, so you can see which one failed.
- If you have never opened developer tools
- In Chrome, right-click anywhere on the page and choose Inspect. Then click the Console or Network tab at the top of the panel.
- If the Network tab is empty
- It only records while it’s open. Keep it open, reload the page, then repeat the steps that cause the bug.
- If a request is red or its status starts with 4 or 5
- Click it, then click Response or Preview. That’s the service’s own explanation of what went wrong. Copy it for your AI tool.
- If the Console shows a red error
- Copy the whole message, including the file name and line number after it. Those tell your AI tool where to look.
- What each status code means
- 404, 401, 403 and 500 each point at a different piece. How the pieces fit
Words: Developer tools, Request, Status code
Where do I find my host’s, database’s and email service’s logs?
In each service’s dashboard. Errors from code on a server never reach your browser. When a request’s status code starts with 5, read your host’s logs for the real error. Your database and email service keep their own.
- Vercel
- Open your project, then Logs in the sidebar. Filter Level to Error. Requests whose status starts with 5 are marked red, and 4 amber.
- Netlify
- Open your site, go to Cloud compute, then Functions, and pick a function to see its log. Logs are kept for at least 24 hours.
- Cloudflare Workers
- Go to Workers & Pages, pick your Worker, then Observability. New Workers have logs on. An older one may need observability turned on in its Wrangler file.
- Supabase
- Open Logs in your project. Pick a Log Type, such as API Gateway, Postgres or Auth, and filter Level to error. Databases
- Resend
- Open the Logs page and filter to Errors. Click a failed request to see its response, and use Copy for AI to paste it into your AI tool. Email
Why does my product work on my computer but not online?
Often it’s a setting, not your code. Before you ask for code changes, check four things: environment variables, access rules, sign-in redirect addresses and keys.
- A missing environment variable
- Your online product doesn’t read your .env file. Add each setting in your host’s dashboard, then put the product online again. On Vercel, changes only reach new deployments. In Next.js, a value the browser needs must start with NEXT_PUBLIC_.
- An access rule blocking reads
- In Supabase, a table with row level security on and no policy returns an empty list, often with no error. In Firebase, if a rule denies access, the whole request fails. Databases
- A wrong redirect URL
- Sign-in sends people back to an address on an allowed list. In Supabase, set the Site URL to your online address instead of localhost and add every address you use to Redirect URLs. Sign-in
- An expired, deleted or wrong key
- The error usually names the key, like Resend’s “API key is invalid”. Check it on the service’s API keys page, make a new one if needed, and update the environment variable.
Words: Environment variable, Row-level security, Redirect URL, API key, Localhost
How do I go back to a version that worked?
If you saved versions with Git, ask your AI tool to list them and take your product back to the last one that worked. Going back changes only your files. Your database, keys and service settings stay as they are.
- If two fixes didn’t work
- Stop stacking fixes. Go back to a version that worked, start a new chat, and describe the bug again from the start.
- If you want to undo one change but keep the rest
- Ask your AI tool to revert that saved version (Git calls it a commit). Git makes a new commit that undoes it, so nothing is lost.
- If you never saved a version
- Use your AI tool’s own undo, if it has one, then start saving a version after each change that works.
- Save versions as you go
- Commits, branches and GitHub let you go back at any time. Saving your code
How do I find bugs when people I can’t watch use my product?
Read your logs, because you can’t see what visitors see. Check them each time you put a new version online, filtered to errors. When someone does write in, ask for their steps, the time it happened and a screenshot, and look up that time in your logs.
- If a bug started right after you put a new version online
- Compare the new version with the one before it. On Vercel, click Instant Rollback on the Production Deployment tile to put the earlier one back while you fix it.
- If the logs don’t show what your code was doing
- Ask your AI tool to add log lines around the part that fails. Each console.log on the server shows up in your host’s logs.
Questions people ask
Updated Sources: Chrome DevTools: Debug JavaScript, Chrome DevTools: Open DevTools, Chrome DevTools: Console overview, Chrome DevTools: Inspect network activity, Vercel: Runtime logs, Vercel: Environment variables, Netlify: Function logs, Cloudflare: Workers Logs, Supabase: Logs, Supabase: Why is my select returning an empty array?, Supabase: Redirect URLs, Firebase: Get started with Cloud Firestore Security Rules, Resend: Logs, Resend: Errors, Next.js: Environment variables, Vercel: Instant Rollback, Git: git revert.