The 50+ Real Error Troubleshooting Encyclopedia
Got red text in PowerShell or VS Code? Don't panic. Search your exact error message below to get the root cause and the immediate 1-click fix.
Why it happens
Node.js executable is missing from Windows System Environment PATH variable.
Prevention
Always check 'Add to PATH' when running Windows installers.
Immediate Fix
Download Node.js LTS from nodejs.org, check 'Add to PATH' in installer, restart VS Code and run 'node -v'.
Why it happens
Another background Node process or old terminal session is occupying port 3000.
Prevention
Use Ctrl+C to gracefully terminate dev servers instead of closing the terminal tab.
Immediate Fix
In PowerShell run: Stop-Process -Id (Get-NetTCPConnection -LocalPort 3000).OwningProcess -Force
Why it happens
Windows PowerShell Execution Policy blocks unsigned npm scripts by default.
Prevention
Configure execution policy once on every new Windows PC.
Immediate Fix
Run PowerShell as Admin: Set-ExecutionPolicy -ExecutionPolicy RemoteSigned -Scope CurrentUser
Why it happens
Row Level Security (RLS) is enabled, but no INSERT policy permits authenticated users to write rows.
Prevention
Always create SELECT, INSERT, UPDATE, and DELETE policies when enabling RLS.
Immediate Fix
In Supabase SQL Editor run: CREATE POLICY 'Users insert own' ON table_name FOR INSERT WITH CHECK (auth.uid() = user_id);
Why it happens
Browser blocked client-side JavaScript from calling third-party API without CORS headers.
Prevention
Server-to-server HTTP requests are never subject to browser CORS restrictions.
Immediate Fix
Call the API from a Next.js Server Action or API Route Handler (app/api/...) instead of the browser.
Why it happens
GitHub repository contains commits (e.g. README created in browser) that your local machine lacks.
Prevention
Never edit files directly on GitHub web before pushing initial local code.
Immediate Fix
Run: git pull origin main --rebase and then run: git push origin main
Why it happens
The package was imported in code but has not been installed in node_modules.
Prevention
Always install packages before importing them in TypeScript files.
Immediate Fix
Run: npm install [package-name] (e.g. npm install lucide-react)
Why it happens
Environment variable is missing from .env.local or server was not restarted after editing .env.
Prevention
Always restart local dev server when modifying environment variables.
Immediate Fix
Restart Next.js dev server (Ctrl+C then npm run dev) and verify variable name has no typos.
Why it happens
HTML generated on server differs from browser (e.g. rendering new Date() or localStorage on server).
Prevention
Keep server components deterministic and use client components for browser APIs.
Immediate Fix
Wrap browser-only code in useEffect() or use dynamic(() => import(...), { ssr: false }).
Why it happens
TypeScript strict mode caught a type mismatch during production build.
Prevention
Run local build (npm run build) before pushing to GitHub.
Immediate Fix
Fix the interface type definition in the file or run 'npx tsc --noEmit' locally to catch errors before push.
Why it happens
DNS TXT (SPF) or CNAME (DKIM) records have not finished propagating across global nameservers.
Prevention
Double check registrar hostnames: many registrars automatically append your domain name.
Immediate Fix
Wait 15 minutes and check https://whatsmydns.net. Ensure no extra domain suffixes were duplicated.
Why it happens
createClient() was called with undefined NEXT_PUBLIC_SUPABASE_URL.
Prevention
Public client variables in Next.js MUST start with NEXT_PUBLIC_ prefix.
Immediate Fix
Check .env.local: ensure variable starts with NEXT_PUBLIC_ if accessed on the client side.
Why it happens
Database connection string has invalid password or IP is blocked by firewall.
Prevention
Keep database credentials secured in password manager and verify pooler ports (6543 vs 5432).
Immediate Fix
Verify connection string password in .env and ensure database provider allows 0.0.0.0/0 incoming connections.
Why it happens
Git for Windows was installed while VS Code was open, or Git bin is not in PATH.
Prevention
Install Git before installing VS Code or restart VS Code after installing tools.
Immediate Fix
Completely close and reopen Visual Studio Code. If still failing, restart Windows PC.
Why it happens
User uploaded a file exceeding the maximum body size allowed by Next.js or cloud host.
Prevention
Always use client-to-bucket direct uploads for files larger than 4.5MB.
Immediate Fix
Upload files directly from browser to Supabase Storage / Cloudflare R2 using Signed URLs instead of proxying through server.
Why it happens
STRIPE_WEBHOOK_SECRET in environment variables does not match the webhook endpoint signing secret.
Prevention
Test webhooks locally using Stripe CLI: stripe listen --forward-to localhost:3000/api/webhooks/stripe.
Immediate Fix
Copy the exact signing secret (starts with whsec_...) from Stripe Dashboard into .env.local.
Why it happens
Attempted to access user profile properties before authentication session has loaded.
Prevention
Always handle loading and unauthenticated states gracefully.
Immediate Fix
Add optional chaining: user?.email or show a loading skeleton while auth state is resolving.
Why it happens
Attempted to read server cookies inside a client component with 'use client'.
Prevention
Keep cookie and database calls in Server Components or Server Actions.
Immediate Fix
Pass the user data as props from a parent Server Component into the client component.
Why it happens
Build command or output directory misconfigured in Cloudflare Pages dashboard.
Prevention
Review official Cloudflare Pages Next.js documentation for current build flags.
Immediate Fix
Set Framework Preset to 'Next.js' and set build command to 'npx @cloudflare/next-on-pages'.
Why it happens
Node application is listening on hardcoded port 3000 instead of process.env.PORT.
Prevention
Cloud hosts like Render and Railway inject a dynamic PORT environment variable at runtime.
Immediate Fix
Update server to listen on: const PORT = process.env.PORT || 3000;