GrahamScreener
09Troubleshooting

Troubleshooting

Quick Reference

SymptomLikely CauseFix
Port 3000 already in useAnother process on the portlsof -ti:3000 | xargs kill -9 then retry npm run dev
SQLITE_BUSY during buildWAL lock contention from parallel Next.js workersDelete data/valuelens.db-shm and data/valuelens.db-wal, then rebuild
SQLITE_BUSY at runtimeConcurrent writes from multiple tabsRefresh the page — WAL mode handles most cases, but rapid writes can still collide
Build fails with type errorsMissing or outdated dependenciesRun npm install to ensure all packages are present
Build fails with better-sqlite3 errorNative binary not compiled for this platformRun npm rebuild better-sqlite3 or delete node_modules and npm install
Blank stock page — no chart, no dataYahoo rate-limited or session expiredWait 60 seconds, then hard-refresh (Cmd+Shift+R). Check browser console for 429/502.
Valuations show "—" for all modelsYahoo's quoteSummary returned incomplete dataThe stock may lack EPS, book value, or EBITDA. Check the fundamentals table — missing inputs mean the formula can't compute.
Charts load but fundamentals don'tCrumb token missing or invalidThe quoteSummary endpoint requires a crumb; chart does not. Reload the page to trigger a fresh session bootstrap.
Search returns 0 resultsYahoo search endpoint rate-limitedWait 30 seconds and try again. If persistent, Yahoo may be blocking your IP temporarily.
Screener shows 0 resultsFilters too strict, or cache is emptyRelax filters (try removing all except exchange). If cache is empty, run npm run snapshot first.
Screener takes >30 secondsCold cache — fetching 50 tickers from YahooNormal on first run. Subsequent runs use the 24h cache and are instant.
429 Too Many Requests from YahooIP rate-limitedWait 1–5 minutes. Reduce snapshot concurrency if it happens consistently.
Empty watchlist after restartDatabase was deleted or resetRun npm run seed to re-populate with 5 sample tickers.
Database file not foundFirst run — DB not yet initialisedStart the dev server (npm run dev) and make any request — the DB auto-creates.
ERR_MODULE_NOT_FOUND on tsx scriptstsx not installedRun npm installtsx is a devDependency.
Dark mode not workingTheme cookie not setClick the sun/moon toggle in the top nav bar. Default is dark.
EU consent blocking YahooYahoo returns HTML instead of JSONKnown limitation. The session manager detects this and falls through. Chart data usually works; quoteSummary may not. Consider using a VPN or switching to a paid data provider.
npm run snapshot hangsNetwork timeout or Yahoo blockingPress Ctrl+C and retry. Check your internet connection.
Missing env vars errorNone expected — but a wrapper tool might inject themGrahamScreener uses zero environment variables (except optional DEMO_MODE). If you see env-related errors, check for proxy or corporate firewall interference.

Resetting Everything

# Nuclear reset — fresh start
rm -rf data/ .next/ node_modules/
npm install
npm run dev
# Visit http://localhost:3000 — DB recreates automatically
npm run seed  # Re-add sample data

Checking Database Health

sqlite3 data/valuelens.db "
  SELECT 'watchlist', COUNT(*) FROM watchlist
  UNION ALL
  SELECT 'trades', COUNT(*) FROM portfolio_trades
  UNION ALL
  SELECT 'cache', COUNT(*) FROM snapshot_cache;
"

Checking Yahoo Connectivity

# Test session bootstrap
curl -sI https://fc.yahoo.com | head -10

# Test search endpoint
curl -s "https://query1.finance.yahoo.com/v1/finance/search?q=AAPL&quotesCount=1" | head -1

# Test chart endpoint
curl -s "https://query1.finance.yahoo.com/v8/finance/chart/AAPL?range=1d" | python3 -c "import sys,json; print(json.load(sys.stdin)['chart']['result'][0]['meta']['regularMarketPrice'])"

Last updated: 2026-05-09 by Claude Cowork