Root Cause: PDF.js worker loading issues in browser
Note about worker version mismatch:
- If you see an error like:
API version "5.4.530" does not match the Worker version "5.4.296", the PDF.js library and the worker file are from different versions. This causes runtime failures when parsing PDFs.
Fixes:
- Delete
node_modulesand runnpm installto ensure dependencies are consistent. - If hosting the worker via CDN, ensure the worker URL uses the same version as
pdfjs-dist(or use the app's dynamic worker versioning which selects the installed version). - As a quick workaround, convert the PDF to .docx or .txt and upload that instead.
Solutions:
-
Quick Fix - Use Alternative File Format
- Convert PDF to DOCX (works better): Use online tools like CloudConvert
- Or copy text from PDF and paste directly
- Or save PDF as .txt file
-
For DOCX Files (Most Reliable)
- Open your PDF in Word or Google Docs
- Save as .docx
- Upload the .docx file ✅
-
For Text Files (Always Works)
- Copy all text from your document
- Paste into the text area
- Click "Generate Flashcards" ✅
Causes:
- PDF is scanned images (not text)
- Document is empty
- Document contains only images
Solutions:
- Use OCR software to convert scanned PDF to text
- Check if document actually has text content
- Try copying text manually
Solution:
1. Check file is not corrupted
2. Try opening file in its native app first
3. Re-save file in compatible format
4. Use .txt format as safest option
Your Nest Hub Resolution:
- Nest Hub: 1024 x 600
- Nest Hub Max: 1280 x 800
The app now automatically adjusts for these screens!
If still having issues:
- Refresh the page (Ctrl+R or Cmd+R)
- Try zooming out (Ctrl+- or Cmd+-)
- Clear browser cache
Fixed in latest version! The app now:
- Limits height to viewport
- Adds scrolling only where needed
- Optimizes spacing for smart displays
Check this:
# Terminal 1 - Is backend running?
npm run server
# You should see:
✅ FlashGen Backend Server
📡 Running on port 3001
🔑 API Key: Configured ✓If not running:
- Open terminal in project folder
- Run:
npm run server - Keep this terminal open
- Open NEW terminal for frontend
Check your .env file:
# Should look like this (no spaces, no quotes)
GEMINI_API_KEY=AIzaSyB1234567890abcdefghijklmnopqrs
# NOT like this:
GEMINI_API_KEY = "AIzaSy..." ❌
GEMINI_API_KEY: AIzaSy... ❌
Steps to fix:
- Get new API key from: https://makersuite.google.com/app/apikey
- Edit .env file (create if missing)
- Paste:
GEMINI_API_KEY=your_actual_key - Save file
- RESTART backend server
Reasons:
- Text is too long (>10,000 characters)
- API is rate limited
- Internet connection issues
Solutions:
- Try with shorter text (500-2000 characters)
- Wait 1 minute and try again
- Check internet connection
- Check backend terminal for errors
Tips for better results:
- Use well-formatted study notes
- Include clear definitions and concepts
- Aim for 500-2000 characters
- Structured content works best
- Include topic headers
✅ Chrome/Edge (Recommended) ✅ Firefox ✅ Safari ✅ Nest Hub Browser
Run these checks in order:
npm run serverExpected output:
✅ FlashGen Backend Server
📡 Running on port 3001
🔑 API Key: Configured ✓
npm run devExpected output:
VITE v5.x.x ready in XXX ms
➜ Local: http://localhost:5173/
➜ press h to show help
Open browser console (F12), look for errors:
- Red errors about CORS? → Backend not running
- 401 errors? → API key issue
- Worker errors? → Use .docx or .txt instead of PDF
Paste this to test if generation works:
Photosynthesis is the process where plants convert sunlight into energy.
It requires water, carbon dioxide, and light. The main product is glucose
and oxygen. Chlorophyll is the green pigment that captures light energy.
If this works, your setup is fine - the issue is with file parsing.
- Best: Open in Word → Save as .docx → Upload
- Easy: Copy all text → Paste in textarea
- Quick: Use online PDF to TXT converter
- Best: File → Export → Word Document → Upload .docx
- Easy: Copy text from slides → Paste in textarea
- Quick: File → Save As → Plain Text (.txt)
- Try: File → Save As → Plain Text (.txt)
- Or: Copy all content → Paste in textarea
✅ Backend running on port 3001? ✅ Frontend running on port 5173? ✅ .env file has valid API key? ✅ Tried with simple text input? ✅ Checked browser console for errors?
- Error message (exact text)
- File type you're uploading
- Browser console errors (F12)
- Backend terminal output
- Steps you've tried
| Error | Meaning | Fix |
|---|---|---|
| "Cannot connect to server" | Backend not running | Start: npm run server |
| "API Error" | Bad API key | Check .env file |
| "Failed to parse file" | File parsing issue | Use .docx or paste text |
| "No text could be extracted" | Empty/scanned file | Convert to text format |
| "Please provide more text" | Less than 50 chars | Add more content |
| "File is too large" | Over 10MB | Use smaller file |
| "Unsupported file type" | Wrong format | Use .txt/.pdf/.docx/.pptx |
Enable Debug Logging:
// In fileParser.js, look for:
console.log(`Parsing file: ${fileName}`)
// All parsing steps are loggedCheck Network Tab:
- Open DevTools (F12)
- Go to Network tab
- Upload file
- Look for failed requests
Test API Directly:
# Test if API key works
curl -X POST \
"https://generativelanguage.googleapis.com/v1beta2/models/gemini/2.5/flash:generateText?key=YOUR_KEY" \
-H 'Content-Type: application/json' \
-d '{"prompt":{"text":"Hello"},"maxOutputTokens":50}'- ✅ Delete node_modules
- ✅ Run
npm installagain - ✅ Create fresh .env file
- ✅ Restart both servers
- ✅ Try in different browser
- ✅ Try on different device
If file upload continues to fail, just:
- Open your document
- Copy all text (Ctrl+A, Ctrl+C)
- Paste in textarea (Ctrl+V)
- Click "Generate Flashcards"
This ALWAYS works! ✅
Remember: When in doubt, use the textarea with copied text - it's the most reliable method!