Troubleshooting
Troubleshooting
Section titled “Troubleshooting”Common problems and their solutions when developing or running Juca.
Installation Issues
Section titled “Installation Issues”better-sqlite3 compilation fails
Section titled “better-sqlite3 compilation fails”Cause: better-sqlite3 is a native C++ addon that requires compilation during npm install.
Solution:
| Platform | Fix |
|---|---|
| macOS | xcode-select --install (installs C++ build tools) |
| Linux (Debian/Ubuntu) | sudo apt-get install build-essential python3 |
| Linux (RHEL/Fedora) | sudo dnf groupinstall "Development Tools" |
Also ensure you are using Node.js 20+ (the version specified in the project):
node --version # Should be v20.x or higherGit LFS files not downloaded
Section titled “Git LFS files not downloaded”Cause: Git LFS was not installed or initialized before cloning, so data files appear as pointer files.
Solution:
git lfs installgit lfs pullVerify: Files in data/ should be their actual size (not small pointer files of ~130 bytes).
npm install fails with peer dependency errors
Section titled “npm install fails with peer dependency errors”Cause: Conflicting package versions or stale lockfile.
Solution:
rm -rf node_modules package-lock.jsonnpm installRuntime Issues
Section titled “Runtime Issues”Authentication errors in development
Section titled “Authentication errors in development”Cause: Missing OAuth configuration (Google Client ID, Auth Secret, etc.).
Solution: Add the dev auth bypass to .env.local:
ENABLE_DEV_AUTH=trueThis creates a dev user without requiring external auth providers. For production, configure the full auth stack — see Environment Variables.
”No API key configured” errors
Section titled “”No API key configured” errors”Cause: Missing LLM provider API keys.
Solution: Add at minimum these two keys to .env.local:
ANTHROPIC_API_KEY=sk-ant-... # Primary generator (required)GROQ_API_KEY=gsk_... # Fast critics (required)Check /api/health to see which providers are configured:
curl http://localhost:3000/api/health | jq '.providers'Valter API connection failures
Section titled “Valter API connection failures”Cause: Valter API unreachable, wrong URL, or invalid API key.
Diagnosis:
curl -H "X-API-Key: $VALTER_API_KEY" \ https://valter-api-production.up.railway.app/healthExpected: HTTP 200 with status ok.
Solutions:
| Symptom | Fix |
|---|---|
| Connection refused | Check VALTER_API_URL in .env.local |
| 401 Unauthorized | Check VALTER_API_KEY value |
| Timeout | Valter may be cold-starting on Railway — wait 30s and retry |
| 503 Service Unavailable | Valter is deploying or overloaded — check Railway dashboard |
SQLite database lock errors
Section titled “SQLite database lock errors”Cause: Multiple processes accessing the SQLite database simultaneously.
Solution:
- Ensure only one dev server is running:
Terminal window lsof -i :3000 # Check what's using port 3000 - Kill orphan Node processes:
Terminal window pkill -f "next dev" - If the lock file persists, restart the dev server
Test Issues
Section titled “Test Issues”72 test files failing
Section titled “72 test files failing”Cause: Technical debt from a coverage sprint (Issue #270). Many tests target backend code that is being migrated to Valter.
What to do:
- Focus on tests relevant to the hub architecture (components, blocks, server actions, unified API)
- Tests for
src/lib/backend/may fail — these are being deprecated - Run specific test files instead of the full suite:
Terminal window npx vitest run src/components # Component tests onlynpx vitest run src/actions # Server action tests only
E2E tests fail to start
Section titled “E2E tests fail to start”Cause: Dev server not running or wrong port.
Solution:
- Start the dev server first:
Terminal window npm run dev - In a separate terminal, run E2E:
Terminal window npm run test:e2e
The Playwright config expects the app at http://localhost:3000. If you are using a different port, update playwright.config.ts.
E2E tests are flaky
Section titled “E2E tests are flaky”Cause: Timing issues with SSE streams, animation delays, or network conditions.
Solutions:
- Use
npm run test:e2e:headedto see what’s happening in the browser - Use
npm run test:e2e:uifor Playwright’s visual debugger - Playwright is configured with 2 retries in CI and 0 locally
- Check
test-results/for failure screenshots
Build Issues
Section titled “Build Issues””Never run next build locally”
Section titled “”Never run next build locally””This is a project rule from CLAUDE.md, not a bug. Builds consume >50% CPU and are prohibited locally.
To verify your changes compile:
- Run
npm run lint(checks for ESLint errors) - Run
npm test(runs unit tests) - Push to your branch — GitHub Actions runs lint + build + tests
To verify deployment:
- Push to
main— Railway auto-deploys with the multi-stage Dockerfile
Getting Help
Section titled “Getting Help”- GitHub Issues: github.com/sensdiego/juca/issues
- Check existing issues before creating new ones
- Include reproduction steps, error messages, and environment details