Common Issues
This guide covers the most common problems and their solutions.
Installation Issues
Error: "Module not found"
Symptom:
Error: Cannot find module 'framer-motion'
Module not found: Can't resolve '@ai-sdk/google'Cause: Missing dependencies or corrupted node_modules
Solution:
# Remove node_modules and lock file
rm -rf node_modules package-lock.json
# Clear npm cache
npm cache clean --force
# Reinstall dependencies
npm install
# Restart dev server
npm run devError: "Node version not supported"
Symptom:
error: The engine "node" is incompatible with this moduleCause: Node.js version is too old
Solution:
# Check your version
node --version
# Install Node.js 18.17+ from nodejs.org
# Or use nvm:
nvm install 18
nvm use 18
# Reinstall and run
npm install
npm run devError: "Port 3000 already in use"
Symptom:
Error: listen EADDRINUSE: address already in use :::3000Cause: Another process is using port 3000
Solution 1 - Use different port:
npm run dev -- -p 3001Solution 2 - Kill the process (macOS/Linux):
lsof -ti:3000 | xargs killSolution 3 - Kill the process (Windows):
netstat -ano | findstr :3000
taskkill /PID <PID_NUMBER> /FAPI & Environment Issues
Error: "API key not configured"
Symptom:
Chat doesn't work
Console shows API key errors
Blank responses
Solution:
Create
.env.localin root directory:
touch .env.localAdd your API key:
GOOGLE_GENERATIVE_AI_API_KEY=your_api_key_hereVerify the variable name is exactly as shown (common typo)
No quotes around the value
Restart the dev server:
# Stop with Ctrl+C, then:
npm run devCheck file location - must be in root, not in
app/folder
Error: "API request failed"
Symptom:
Failed to fetch
Network error
429 Too Many RequestsCauses & Solutions:
1. Invalid API key:
Go to Google AI Studio
Verify key is active
Generate new key if needed
Update
.env.local
2. Rate limit exceeded:
Google AI free tier has limits
Wait 1 minute and try again
Consider upgrading API tier
3. Network issues:
Check internet connection
Disable VPN temporarily
Check firewall settings
4. API service down:
Check Google AI status
Try again later
Environment variables not loading
Symptom: Variables work locally but not in production
Solution for Vercel:
Go to Project → Settings → Environment Variables
Add
GOOGLE_GENERATIVE_AI_API_KEYSelect all environments (Production, Preview, Development)
Redeploy the project
Solution for local:
Verify file is named
.env.localexactlyRestart dev server after changes
Check
.gitignoreincludes.env.local
Build Issues
Error: "Build failed"
Symptom:
npm run build
Error: Build failed with X errorsCommon causes:
1. Syntax errors:
# Check for missing brackets, quotes, etc.
npm run lint2. Import errors:
// ❌ Wrong
import { Component } from 'wrong-path';
// ✅ Correct
import { Component } from './correct-path';3. Type errors (if using TypeScript):
# Fix type issues or add @ts-ignore4. Environment variables:
# Ensure all required env vars exist in build environmentGeneral solution:
# Clean build cache
rm -rf .next
# Reinstall dependencies
rm -rf node_modules
npm install
# Try building again
npm run buildError: "Tailwind CSS not working"
Symptom:
No styles applied
Plain HTML appearance
Missing colors
Solution:
Verify Tailwind installation:
npm install -D tailwindcss@^4 @tailwindcss/postcss@^4Check
globals.csshas:
@import "tailwindcss";Verify import in
layout.js:
import "./globals.css";Clear cache and rebuild:
rm -rf .next
npm run devRuntime Issues
Cooldown doesn't work
Symptom: Can send multiple messages without waiting
Solution:
Check browser console for JavaScript errors
Verify localStorage is enabled:
// Test in browser console
localStorage.setItem('test', 'value');
console.log(localStorage.getItem('test')); // Should show 'value'Clear localStorage:
// In browser console
localStorage.clear();Refresh the page and try again
Cooldown stuck at 50 seconds
Symptom: Countdown never decreases
Solution:
Check browser console for errors
Clear localStorage:
localStorage.removeItem('lastSubmitTime');Refresh the page
Check useEffect is working:
// Should see countdown decrease every second
console.log('Cooldown:', cooldownRemaining);Messages not displaying
Symptom:
Send message but nothing appears
Blank chat area
No error messages
Solution:
Check browser console for errors
Verify API is responding:
# Test endpoint manually
curl -X POST http://localhost:3000/api/chat \
-H "Content-Type: application/json" \
-d '{"messages":[{"role":"user","content":"test"}]}'Check network tab in DevTools:
Is request being sent?
What's the response status?
Any errors?
Verify
useChathook is working:
console.log('Messages:', messages);
console.log('Status:', status);Streaming responses are slow
Symptom: AI takes 30+ seconds to respond
Causes & Solutions:
1. Web search is slow (expected):
Searches take 5-15 seconds
This is normal for real-time data
Consider reducing search requirements
2. Large max tokens:
// Reduce from 4000 to 2000
maxTokens: 20003. Network latency:
Check internet speed
Try different network
Disable VPN
4. Google AI API slow:
Try at different time
Check API status
Consider different region
UI Issues
Matrix rain causing lag
Symptom: Animations are choppy, page is slow
Solution 1 - Disable on mobile:
const [isMobile, setIsMobile] = useState(false);
useEffect(() => {
setIsMobile(window.innerWidth < 768);
}, []);
{!isMobile && <MatrixRain />}Solution 2 - Reduce complexity:
// In MatrixRain.js
// Reduce number of columns
const columnCount = Math.floor(canvas.width / 10); // Increase 10 to 20Solution 3 - Remove completely:
// Comment out in page.js
// <MatrixRain />Styles not updating
Symptom: CSS changes don't appear
Solution:
Hard refresh browser:
Chrome/Firefox: Ctrl+Shift+R (Cmd+Shift+R on Mac)
Safari: Cmd+Option+R
Clear .next folder:
rm -rf .next
npm run devCheck Tailwind classes are correct:
// ✅ Correct
className="bg-black text-white"
// ❌ Wrong (custom CSS needed)
className="custom-style"Icons not showing
Symptom: Square boxes instead of icons
Solution:
Verify lucide-react is installed:
npm install lucide-reactCheck import:
import { Eye, Send, Loader2 } from 'lucide-react';Clear cache and reinstall:
rm -rf node_modules .next
npm install
npm run devDeployment Issues
Vercel build fails
Symptom: Deployment fails with build errors
Solution:
Test build locally first:
npm run buildCheck build logs in Vercel Dashboard
Verify environment variables are added
Ensure Node version matches:
// package.json
{
"engines": {
"node": ">=18.17.0"
}
}Check for ESLint errors:
npm run lintFunction timeout on Vercel
Symptom:
Error: Function exceeded maximum duration of 10sCause: Vercel Hobby plan has 10-second limit
Solutions:
Option 1 - Upgrade to Pro ($20/month):
60-second limit
Better support
More resources
Option 2 - Reduce timeout:
// app/api/chat/route.js
export const maxDuration = 10; // Down from 50Then adjust cooldown in app/app/page.js to match.
Option 3 - Use different host:
Railway
Render
Self-hosted
Domain not working
Symptom: Custom domain doesn't load
Solution:
Wait 24-48 hours for DNS propagation
Verify DNS records:
Type: A
Name: @
Value: 76.76.21.21
Type: CNAME
Name: www
Value: cname.vercel-dns.comCheck DNS propagation:
Visit whatsmydns.net
Enter your domain
Check if records are propagating
Verify in Vercel Dashboard:
Settings → Domains
Check for error messages
SSL certificate status
Performance Issues
Page loads slowly
Optimization checklist:
Optimize images:
// Use Next.js Image component
import Image from 'next/image';
<Image src="/logo.png" width={100} height={100} />Reduce animations:
// Disable or simplify animations
transition={{ duration: 0.2 }} // Reduce from 0.5Code splitting:
// Lazy load components
const MatrixRain = dynamic(() => import('./components/MatrixRain'), {
ssr: false
});Analyze bundle:
npm run build
# Check .next/analyze for bundle sizeHigh API costs
Symptom: Google AI bill is high
Solutions:
Reduce max tokens:
maxTokens: 2000 // Down from 4000Implement caching:
// Cache common queries
const cache = new Map();Increase cooldown:
// 60 seconds instead of 50
if (timeSinceLastSubmit < 60) { ... }Monitor usage:
Check Google AI Studio quota
Set up billing alerts
Track usage per day
Getting More Help
If your issue isn't listed here:
Check the logs:
Browser console
Terminal output
Vercel logs (if deployed)
Search GitHub Issues:
Someone may have solved it
Ask for help:
Include error messages and logs
Read related docs:
Still stuck? Open an issue with detailed information and we'll help you out!
Last updated