How to classify these bugs, fix them fast, and stop AI from wreaking havoc
By Karen Spinner
Published: 2026-05-29
URL: https://wonderingaboutai.substack.com/p/a-field-guide-to-11-common-vibe-coding
Disclosure: I have personally experienced (er, committed?) all the bugs described in this article. I used Claude Code to help analyze my personal “library” of bugs and group them into useful categories.
Imagine it’s 2 a.m., and you’re trying to get a responsive form to work. You want the user to answer one question and then see relevant follow-up questions based on their response. But no matter what you do, the JavaScript event handlers fail and the user keeps getting the same generic questions no matter how they answered.
Since throwing your laptop out the window isn’t an option, what do you do?
Based on my own experience, I’d start by stepping away from your laptop and getting some sleep. Bugs at 2 a.m. are almost never the bug you think they are.
Once you’re rested, clear your model’s context window, explain the problem again, and ask it to help you debug. Emphasize that your goal is to understand the root cause of the behavior, not just to make the symptom go away. When you know exactly what’s happening, ask your model to propose two or three solutions and pick the one that best addresses the cause.
This approach can fix most bugs. But sometimes, AI gets stuck in a diagnostic loop, running the same tests and suggesting the same unsuccessful fixes over and over again. When this happens, it helps to try classifying the bug on your own so you can offer your coding model more direct guidance.
After two years of vibe coding (and regular coding), I’ve noticed that most bugs can be identified, at least at a high level, from how your app is behaving or misbehaving.
This article outlines the most common bugs, how to identify them, and tips for prompting your model to make better, faster fixes.
TLDR: When AI gets stuck on a bug, offering the same unsuccessful fix again and again, identifying the bug yourself and giving your model a focused, diagnostic prompt can help move things along. Common types of bugs include runtime errors, state management, async/timing, UX/visuals, performance, API/integration, authentication, data/database, logic, deployment, and tooling issues. They all have behavioral “tells” that show up in testing.
Learn how to identify these bugs and prompt AI in ways that avoid common coding mistakes.
p.s. I built a debugging tool for vibe coders Paid subscribers to Wondering About AI now have access to my debugging tool that classifies bugs based on your description and screen captures, and gives you structured troubleshooting prompts for your coding agent.
If you’re curious, it’s free for everyone the first time.
1. Runtime errors
These bugs are big and obvious, and that’s a good thing. Your app throws an error, the page goes white or the console fills with red, and somewhere a stack trace points at a line of code. And, while error messages can look scary, they typically provide a clear map to what is wrong.
The symptom. In JavaScript: “Cannot read property ‘x’ of undefined.” “x is not a function.” “Unexpected token.” In Python: “NameError,” “TypeError,” “AttributeError.” In any language, you’ll see a stack trace pointing at a specific file and line number, with an error message describing what went wrong.
The cause. Usually one of three things. The code is trying to use a variable that’s undefined because it hasn’t loaded yet, was never set, or got cleared somewhere upstream. The code is calling a method on the wrong type of thing (a string instead of an array, an object instead of a function, None where a dict was expected). Or there’s a syntax error your editor didn’t catch because your AI model wrote something that almost looks right.
The smoking gun. The line the stack trace points at is usually not where the bug is. It’s where the bug surfaces. The actual bug is wherever the variable became undefined, or wherever the wrong type got assigned. It’s easy to fix the symptom on the highlighted line and watch the error pop up somewhere else two minutes later.
What to do. Paste the full error message and stack trace into your AI model. Don’t paraphrase, don’t trim it. Ask AI to trace backward from the failing line to find where the variable was last assigned or where the type got mangled. The fix is usually two or three steps upstream from where the error appears.
2. State management bugs
These bugs make you question whether the code in front of you is the code that’s actually running. The app appears to mostly work, but fails intermittently and inconsistently.
The symptom. A value on screen is stale. A click handler does something based on data that’s already changed. A form submits with values from two seconds ago. Navigating away and coming back resets things that shouldn’t reset, or fails to reset things that should. There’s usually no error message.
The cause. A piece of state lives somewhere your code doesn’t expect, or updates on a different schedule than your UI. In React, this often means a hook captured an old value inside a closure and isn’t seeing the latest one. In any framework, it can mean two pieces of state are supposed to stay in sync but don’t, or a cache is serving you yesterday’s data without telling you.
The smoking gun. The bug appears or disappears depending on the sequence of actions. Works the first time, breaks the second. Works when you do A then B, breaks when you do B then A. If the symptom depends on order, you’re looking at state.
What to do. Describe the exact sequence of actions to your AI model, including what worked and what didn’t. Ask which pieces of state are shared between those actions and which one is most likely stale. Avoid asking for a fix until you’ve identified the specific variable that’s holding the wrong value. State bugs respond badly to guesswork.
3. Async and timing bugs
These bugs happen when functions that depend on each other may not run in the right order.
The symptom. A loading spinner that never resolves. Data that appears, then gets overwritten by older data half a second later. A submit button that fires twice. An API call that returns successfully but the result never shows up on screen. Sometimes the bug only appears on a slower connection or a slower device.
The cause. Code that depends on something finishing before something else starts, without enforcing that order. Common patterns: a missing await on an async function, a useEffect that fires before its dependencies are ready, two parallel API calls where one was supposed to finish first, or an event handler that’s running while another instance of it is still in progress.
The smoking gun. The bug is inconsistent. Sometimes it happens, sometimes it doesn’t. It might be worse when you throttle the network, or when you click quickly, or when you run it on someone else’s slower laptop. Inconsistency is the tell.
What to do. Ask your AI model to identify every async operation in the relevant code path and the order it’s supposed to happen in. Then ask whether anything in that path could complete out of order. The fix usually involves an explicit await, a guard clause that checks whether something is ready, or restructuring the code so the dependent operation can’t start early.
4. UX and visual bugs
These bugs cover situations in which your app runs, but the UI looks wrong or behaves weirdly.
The symptom. Elements overlap, disappear, or shift around. A button is unclickable because something invisible is sitting on top of it. The layout breaks on mobile but works on desktop, or vice versa. A modal opens behind other content. Text gets cut off, or scrolls when it shouldn’t, or doesn’t scroll when it should.
The cause. Usually CSS, and usually one of three things. A z-index war (multiple elements stacking in unexpected order). A layout system collision (flexbox or grid behavior overriding what you expected). Or a responsive design hole, where the styles work at one screen size but break at another. Occasionally it’s a missing import or a Tailwind class that’s spelled almost right but doesn’t exist.
The smoking gun. The bug looks completely different in the browser’s dev tools than it does in your code. Inspect the element, and you’ll see it has properties you didn’t set, or is missing ones you thought you set. The computed styles are the truth.
What to do. Open the browser’s dev tools, inspect the broken element, and screenshot the computed styles panel. Paste the screenshot or the styles directly to your AI model. Ask which rule is winning the cascade and why. Visual bugs are usually fixed by understanding which rule is overriding which, not by piling on more CSS.
5. Performance bugs
You know you have a performance bug when it seems like everything in your app takes forever. It technically works, but it’s frustrating to use.
The symptom. Pages take seconds to load. Clicking a button has a delay before anything happens. Scrolling stutters. The browser tab uses more memory over time. Sometimes the app becomes completely unresponsive and you have to refresh.
The cause. There are several common patterns, which include:
- A component re-rendering on every keystroke when it doesn’t need to
- A useEffect that triggers another useEffect in a loop
- An API call inside a render function, firing every time the component renders
- A large dataset loaded into memory all at once instead of paginated
- An image or video file that’s massive and uncompressed
The smoking gun. The slowdown gets worse over time within a single session. If a fresh page load is fast but after five minutes of use everything crawls, you’re leaking something (renders, listeners, memory). If it’s slow from the first load, you’re loading too much or doing too much synchronously at startup.
What to do. Open the browser’s performance tab and record a session that demonstrates the slowdown. Save the profile. Ask your AI model to identify the most expensive operation in the recording. Performance bugs respond well to data and badly to guesswork. Don’t optimize before you’ve measured.
6. API and integration bugs
These bugs occur when your app is talking to an external service, and one of them misunderstands the conversation.
The symptom. A request that returns success but no data. A request that returns data in a shape you didn’t expect. A 401, 403, 404, or 500 error from a third-party service. Functionality that worked yesterday and doesn’t work today, with no changes on your side.
The cause. Usually one of three things. A schema mismatch: the API returns a field as a string when your code expects a number, or wraps the result in a top-level “data” object that your code isn’t unwrapping. A missing or incorrect authentication header. Or a silent change on the API’s side (deprecation, rate limit, format change) that your code wasn’t notified about.
The smoking gun. The error happens at the boundary of your code and the external service. Logs from your code show the request going out fine. Logs from the service show the request arriving fine. The misunderstanding is in what each side expected from the other.
What to do. Capture the exact request and response, including headers, status codes, and the raw response body. Share them with your AI model. Ask whether the response matches what your code expects to parse. If the service has a changelog or status page, check it. API bugs are often easier to diagnose with documentation than with code.
7. Authentication bugs
These bugs are straightforward if annoying: the user can’t get in, can’t stay in, or can get in when they shouldn’t.
The symptom. Login that succeeds but immediately bounces back to the login screen. Sessions that expire too fast or never expire. A protected route that’s accessible without logging in. A user who can see another user’s data. OAuth flows that loop forever or fail with cryptic errors.
The cause. A few common patterns. Cookies or tokens not being set with the right domain, path, or sameSite attributes. JWTs being validated incorrectly, or not at all. Session storage on the server not matching session expectations on the client. Auth middleware that protects some routes but not others. OAuth callback URLs that don’t match what’s registered with the provider.
The smoking gun. The bug behaves differently in different browsers, different incognito windows, or different devices. Auth state lives in cookies and storage, which behave differently across contexts. If your bug shows up in Chrome but not Firefox, or in incognito but not normal, it’s almost certainly auth-shaped.
What to do. Open the browser’s application tab, inspect cookies and storage for your domain, and see what’s actually being stored after a login attempt. Share the names and properties (not the values) of what you see with your AI model. Auth bugs are about state that lives in places code doesn’t read by default, so making that state visible is the first move.
8. Data and database bugs
You may suspect a data bug when the data on the screen doesn’t match what’s in the database, or what’s in the database is just wrong.
The symptom. A record that exists in your admin panel but doesn’t show up in the app. Updates that appear to succeed but don’t persist. Foreign keys pointing at the wrong rows. A migration that ran on your local database but not on production. Numbers that are off by one, or off by a factor of a hundred, or simply wrong in ways you can’t trace.
The cause. Common patterns include:
- A migration that wasn’t run on every environment
- An insert or update that’s silently failing because of a constraint
- A query that joins the wrong tables and returns near-correct results
- Data that’s being transformed on the way out but not the way in (or vice versa)
- Timezone bugs where dates shift by hours depending on where you read them
The smoking gun. The data in the database (when you query it directly) doesn’t match what your app shows. If your admin panel or SQL query reveals a different picture than the app’s UI, the bug is between the database and the screen.
What to do. Run the relevant query directly against your database. Screenshot or paste the actual rows. Compare them to what your app is showing. Tell your AI model what’s in the database, what’s on the screen, and ask which step between the two is corrupting or filtering the data.
9. Logic bugs
You may have one of these bugs when your app does something it’s not supposed to.
The symptom. A calculation returns a number that looks reasonable but is wrong. A filter shows the wrong subset of items. A workflow advances when it shouldn’t, or stalls when it should advance. A discount applies twice, or not at all. A condition that should be true is false. Often, these bugs are discovered only when someone notices results that don’t make sense.
The cause. The logic itself is incorrect. An off-by-one error in a loop. A comparison using the wrong operator (greater than instead of greater than or equal to). A boolean condition with mismatched AND/OR. A function returning early before reaching the case you cared about. Edge cases the original code never accounted for.
The smoking gun. No error message, no obvious symptom, just outputs that are wrong on inspection. The bug is invisible until someone runs a specific case and notices the result is wrong. Often surfaces weeks after the code was written, when real data exposes the gap.
What to do. Write down what the code is supposed to do, in plain English, including edge cases. Paste that description and the relevant code to your AI model. Ask which inputs would produce outputs that contradict your description. Logic bugs are usually found by treating the code as a specification and stress-testing it against the spec, not by reading the code line by line.
10. Deployment bugs
This is a classic bug in which your app works on your laptop but not in the cloud.
The symptom. Code that runs perfectly locally fails in production. Environment variables that exist on your machine are missing on the server. A package that installed fine doesn’t work after deployment. Builds that succeed locally fail in the CI pipeline. The Puppeteer or Chromium browser that runs your headless tasks works locally but errors out on Vercel or Railway. Different Node versions, different OS, different filesystem behavior.
The cause. The runtime environment in production isn’t identical to your laptop, and your code depends on something that’s different between them. Missing env vars. Different OS-level binaries (looking at you, Chromium). Different Node or Python versions. Files that exist in your local working directory but were never committed. Build steps that run locally but were never added to the deploy script.
The smoking gun. “Works on my machine.” If you can reproduce the bug locally only by replicating the production environment (different OS, no env vars, fresh clone of the repo), you’re in deployment territory.
What to do. Get the production logs. Not the build logs, the runtime logs from when the app actually crashed. Pass them to your AI along with whatever environment differences you know about (Node version, OS, missing env vars). Deployment bugs are usually solved by making the difference between local and production explicit, then closing each gap.
11. Tooling bugs
These bugs are in the tools that build, lint, or compile your code.
The symptom. A build that fails with cryptic errors about packages you didn’t directly install. Imports that worked yesterday and don’t work today after running npm install. TypeScript errors in node\_modules that you can’t fix because you didn’t write that code. Linter complaints that don’t match what your editor shows. Dependency conflicts that produce essays of red text in your terminal.
The cause. Package managers, build tools, and compilers have opinions about how your project should be structured, and sometimes those opinions conflict. Common patterns: a dependency that’s incompatible with another dependency. A version mismatch between your local Node and what your build tool expects. A tsconfig or webpack config that’s slightly off. Cached state in node\_modules or .next that’s gone stale and is now lying to you.
The smoking gun. The error happens during a build, install, or compile step rather than at runtime. If your code never runs because the build never finishes, you’re in tooling. If a fresh clone of the repo behaves differently than your current working copy, the bug is in your local state.
What to do. Try deleting node\_modules and the lockfile, then reinstalling. If that fixes it, you had stale state. If it doesn’t, copy the full error output (including the npm or pnpm trace) and share it with your AI model. Tooling bugs respond well to fresh starts and badly to incremental fixes.
When AI gets stuck
While most frontier AI models are generally good at coding, sometimes they fail in ways that either make it harder to troubleshoot or add new bugs to your code.
Here are some of the most common issues:
Looping on the same broken fix.
You report a bug. AI says “I see the issue” and proposes a fix. The fix doesn’t work. You report it again. AI says “I see the issue” and proposes a small variation of the same fix. Half an hour later you’re four versions deep into a fix that was wrong the first time. The bug in your code might be trivial. The bug in the session is that AI has glommed onto a wrong hypothesis and can’t release it.
What to do. Stop the session, clear the context, and start fresh in a new conversation. Sometimes switching to a different model entirely (Sonnet to Opus or vice versa, Claude to GPT-5) breaks the anchor faster than any prompt change.
Silent context degradation.
This issue happens during long sessions with lots of files in context and many rounds of back-and-forth. At some point your AI starts deleting comments, simplifying logic, removing edge cases it added earlier, and not flagging any of it. Your code is technically still working, but it’s worse than it was an hour ago. This shows up most in long agentic sessions where the model is making many edits in a row.
What to do. Commit frequently, review diffs before accepting them, and watch for unexpected changes in files you didn’t ask about. If you notice degradation has happened, roll back to a known good commit rather than asking AI to “put back” what it deleted. It often can’t.
Fictional code, libraries, and packages.
AI sometimes writes code that calls methods, imports modules, or passes parameters that don’t exist in the library you’re using. The most common patterns are calling a method on a library that isn’t really there, importing something from a package that doesn’t export it, or passing arguments in an order or other format the function doesn’t actually accept.
When you paste the error back, AI sometimes invents a slightly different fake method, or insists the method exists and the problem must be elsewhere.
What to do. Don’t trust generated code for any library AI might not know well. Instead, put the real docs in front of your model rather than asking it to remember them. Paste the relevant section of the official documentation into the conversation, point the model at the docs URL if your tool can fetch web pages, or use a coding agent that can look up library documentation directly.
If none of that’s available, open the docs yourself and verify that the methods, imports, and parameters your model used actually exist before running the code.You can’t rely on AI citing its sources, since models can invent citations as confidently as they invent code. Libraries with major version bumps in the last year (Next.js 16, Tailwind 4) are the highest-risk category.
Unauthorized scope creep.
You asked for one change. Your AI model rewrote three other files “for consistency” or “while I was in there.” You now have a new bug surface you didn’t ask for, can’t fully see, and didn’t approve. This is especially dangerous in agentic coding environments where AI can edit multiple files in a single turn.
What to do. Use plan mode where available, ask your AI to list every file it intends to modify before any changes happen, and reject anything outside the scope you specified. If you discover unauthorized changes after the fact, roll back and try again with stricter scoping.
Obstructive hedging.
You ask for help with something your model reads as risky (auth flows, payment processing, content moderation, anything touching user safety). Instead of building, AI responds with caveats, partial answers, and recommendations to “consult a professional.”
What to do. Be explicit about your context and why you need the full implementation. “I’m building a prototype for my own use” or “I’m implementing the standard OAuth flow described in [provider]’s docs” usually gets AI past the caution. If a particular task keeps hitting hedging, try a different model. Different models have different risk thresholds.
Towards a less buggy future
Remember the form bug from the opening? It turned out to be a state bug complicated by an async timing bug. And I ultimately fixed it by researching best practices for using event handlers in plain JavaScript, feeding these ideas to Claude, and asking it to find the root cause of the problem before attempting to fix the code.
Since then, I’ve learned to step in early when AI struggles to resolve a bug. Instead of allowing it to iterate five, ten, or twenty times, I research the issue myself and develop a diagnostic plan before I go back to AI. And this is a big part of why it now takes me hours to build apps that work instead of weeks.
Good luck squashing your own bugs. I’d love to hear about your most epic ones in the comments!
Congratulations, you made it to the end!