Bug

A bug is an error or flaw in code that causes unexpected behavior — a button that doesn't work, a calculation that returns wrong results, or a page that crashes. In vibe coding, bugs often come from AI misunderstanding your intent, hallucinating APIs, or generating code that works in isolation but breaks in context.

Example

AI generates a date picker that works perfectly in US format (MM/DD/YYYY) but breaks for European users expecting DD/MM/YYYY. The code runs fine — it just does the wrong thing for some users. That's a bug.

Bugs are inevitable — even in AI-generated code. The difference with vibe coding is that AI can also help you find and fix them.

Types of Bugs

Syntax Bugs

  • Missing brackets, typos, wrong symbols
  • Caught by your editor before code runs
  • AI rarely introduces these

Logic Bugs

  • Code runs but produces wrong results
  • Harder to find — requires testing
  • AI occasionally introduces these

Integration Bugs

  • Individual pieces work but break together
  • Common when AI generates code without full context
  • Often caught during testing

Common AI-Generated Bugs

  • Hallucinated APIs — Using methods that don't exist
  • Wrong assumptions — AI assumes a different data structure
  • Missing edge cases — Works for the common case, breaks on exceptions
  • Version mismatches — AI uses patterns from an older library version

Debugging Workflow

  1. Reproduce the bug — Can you make it happen consistently?
  2. Read the error message — It often points to the problem
  3. Isolate the cause — Which part of the code is responsible?
  4. Fix and test — Make the change and verify it works
  5. Check for related issues — The same bug pattern might exist elsewhere

AI as Debugging Partner

Paste an error message to AI and describe what you expected. AI is excellent at:

  • Explaining cryptic error messages
  • Suggesting fixes based on the error
  • Identifying patterns that commonly cause specific bugs
  • Reviewing code for potential issues before they become bugs