← Cheatsheets / Reference

Common Errors & How to Fix Them

The errors you'll see most often when vibecoding — and exactly how to resolve them.

errors debugging troubleshooting fixes

Stuck on an error? Find it here, get the fix, move on.

Jump to:

Cmd/Ctrl+F to search for your exact error.


AI Tool Errors

Claude Code

ErrorCauseFix
ANTHROPIC_API_KEY not setMissing API keyexport ANTHROPIC_API_KEY="sk-ant-..."
Rate limit exceededToo many requestsWait 60s, or use /compact to reduce tokens
Context window exceededConversation too longUse /compact or /clear and restart
Permission deniedFile system restrictionRun with --dangerously-skip-permissions (careful!)
Model not foundInvalid model nameCheck claude --help for valid models

Cursor

ErrorCauseFix
Failed to connectAPI/network issueCheck internet, restart Cursor
Model context length exceededToo much contextSelect less code, close tabs
Composer failedMulti-file op failedTry smaller scope, check file permissions
Rate limitToo many requestsWait or upgrade plan

GitHub Copilot

ErrorCauseFix
Copilot not availableNot logged inSign in via VS Code accounts
No suggestionsContext unclearAdd comments, improve variable names
Suggestion cut offToken limitAccept partial, ask for continuation

JavaScript / TypeScript

Module Errors

ErrorFix
Cannot find module 'X'npm install X or check import path
Module not found: Can't resolveCheck spelling, add file extension
SyntaxError: Cannot use importAdd "type": "module" to package.json
__dirname is not definedUse import.meta.dirname in ES modules

Type Errors

ErrorFix
Type 'X' is not assignable to 'Y'Check types match, add type assertion
Property 'X' does not exist on typeAdd property to interface or use optional chaining
Object is possibly 'undefined'Add null check: if (obj) { ... }
Argument of type 'X' is not assignableCast with as Type or fix the type

Runtime Errors

ErrorFix
TypeError: Cannot read property 'X' of undefinedAdd null check before accessing
ReferenceError: X is not definedCheck variable spelling, scope, imports
RangeError: Maximum call stack exceededFix infinite recursion
SyntaxError: Unexpected tokenCheck for missing brackets, commas

Python

Import Errors

ErrorFix
ModuleNotFoundError: No module named 'X'pip install X or check venv
ImportError: cannot import name 'X'Check export exists, circular imports
ModuleNotFoundError: No module named 'src'Add __init__.py or fix PYTHONPATH

Type Errors

ErrorFix
TypeError: 'NoneType' object is not subscriptableCheck for None before indexing
TypeError: unsupported operand type(s)Check variable types, add conversion
AttributeError: 'X' object has no attribute 'Y'Check spelling, object type

API Errors

ErrorFix
requests.exceptions.ConnectionErrorCheck URL, network, try/except
json.decoder.JSONDecodeErrorValidate JSON, check response content-type
KeyError: 'X'Use .get('X') or check key exists

React / Next.js

Common Errors

ErrorFix
Hydration failedServer/client mismatch — check dynamic content
Invalid hook callHooks only in components, check React version
Too many re-rendersMove state update out of render, add deps
Cannot update during renderUse useEffect for side effects
Each child should have unique keyAdd key prop to list items

Next.js Specific

ErrorFix
'use client' must be firstMove 'use client' to line 1
Attempted import error: 'X' not exportedCheck named vs default export
Dynamic server usageAdd export const dynamic = 'force-dynamic'
NEXT_PUBLIC_ prefix requiredEnv vars for client need NEXT_PUBLIC_

Git Errors

ErrorFix
fatal: not a git repositorygit init or cd to repo
error: failed to pushgit pull --rebase first
CONFLICT (content)Edit file, git add, git commit
Permission denied (publickey)Add SSH key: ssh-add ~/.ssh/id_ed25519
remote: Repository not foundCheck URL, permissions

Database Errors

PostgreSQL

ErrorFix
connection refusedCheck if Postgres is running
relation "X" does not existRun migrations, check table name
duplicate key value violates uniqueHandle conflict or check data

Prisma

ErrorFix
Environment variable not found: DATABASE_URLAdd to .env
P2002: Unique constraint failedHandle duplicate, check data
P2025: Record not foundCheck ID exists before update/delete

Quick Debug Prompts

Copy these to ask AI for help:

I'm getting this error:
[PASTE ERROR]

Here's the relevant code:
[PASTE CODE]

What I expected to happen:
[DESCRIBE]

What actually happened:
[DESCRIBE]
This error started appearing after I:
[DESCRIBE CHANGE]

The full stack trace is:
[PASTE TRACE]

Help me understand what went wrong.

Pro Tips

Tip: Copy the FULL error message, including stack trace. AI needs context.

Tip: “It doesn’t work” is not helpful. Describe expected vs actual behavior.

Tip: When an error persists, ask AI: “What are ALL the possible causes of this error?”

Tip: Search the error message in quotes on Google/Stack Overflow before asking AI.


🎯 Error Not Listed?

  1. Copy the full error message
  2. Use this prompt:
    I'm getting this error: [PASTE ERROR]
    
    Code: [PASTE RELEVANT CODE]
    
    What I tried: [DESCRIBE]
    
    Help me fix it and explain why it happened.
  3. Ask in Discord if AI can’t help

Learn More

✓ Copied to clipboard!