Troubleshooting Guide¶
Common issues and their solutions for Juddges Legal Assistant.
Table of Contents¶
- Installation Issues
- Backend Issues
- Frontend Issues
- Database Issues
- Docker Issues
- API Issues
- Development Issues
- Performance Issues
- Getting Help
Installation Issues¶
Python Poetry Installation Fails¶
Problem: curl -sSL https://install.python-poetry.org | python3 - fails
Solution:
# Try with pip instead
pip install --user poetry
# Or use alternative installation
python3 -m pip install --upgrade pip
pip3 install poetry
# Add Poetry to PATH
export PATH="$HOME/.local/bin:$PATH"
Node.js Version Mismatch¶
Problem: error: This project requires Node.js 20+
Solution:
# Install nvm (Node Version Manager)
curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.39.0/install.sh | bash
# Install and use Node 20
nvm install 20
nvm use 20
nvm alias default 20
# Verify
node --version # Should show v20.x.x
Docker Not Running¶
Problem: Cannot connect to the Docker daemon
Solution:
# Start Docker
# macOS/Windows: Start Docker Desktop application
# Linux: Start Docker service
sudo systemctl start docker
sudo systemctl enable docker
# Add user to docker group (Linux)
sudo usermod -aG docker $USER
newgrp docker
# Verify
docker ps
Backend Issues¶
Module Not Found Errors¶
Problem: ModuleNotFoundError: No module named 'juddges_search'
Solution:
cd backend
# Reinstall dependencies
poetry install
# Verify packages are installed
poetry show
# If still failing, try fresh install
rm -rf .venv
poetry install
FastAPI Server Won't Start¶
Problem: Backend crashes on startup
Check logs:
Common causes:
-
Missing environment variables:
-
Port already in use:
-
Database connection fails:
Import Errors with Pydantic¶
Problem: pydantic.errors.PydanticImportError or version conflicts
Solution:
cd backend
# Check Pydantic version
poetry show pydantic
# Should be < 2.11 per pyproject.toml
# If not, reinstall with constraints
poetry install
OpenAI API Errors¶
Problem: openai.error.RateLimitError or openai.error.AuthenticationError
Solutions:
-
Invalid API key:
-
Rate limits:
-
No credits:
- Check your OpenAI account balance
- Add payment method if needed
Frontend Issues¶
Frontend Won't Start¶
Problem: npm run dev fails
Solutions:
-
Module not found:
-
Port already in use:
-
TypeScript errors:
Build Fails¶
Problem: npm run build fails
Common causes:
-
Type errors:
-
Missing environment variables:
-
Memory issues:
Hot Reload Not Working¶
Problem: Changes not reflected in browser
Solutions:
-
Clear Next.js cache:
-
Check file watchers (Linux):
-
Use stable mode:
Database Issues¶
Cannot Connect to Supabase¶
Problem: Database queries fail
Solutions:
-
Check Supabase credentials:
-
Verify project is active:
- Go to https://supabase.com/dashboard
- Check project status
-
Ensure project is not paused
-
Check network connectivity:
Migration Fails¶
Problem: supabase db push fails
Solutions:
-
Check migration syntax:
-
Check Supabase CLI version:
-
Manual migration:
Vector Search Not Working¶
Problem: Semantic search returns no results
Solutions:
-
Check pgvector extension:
-
Check embeddings:
-
Reingest data:
Docker Issues¶
Docker Compose Fails to Start¶
Problem: Services crash on startup
Solutions:
-
Check logs:
-
Rebuild images:
-
Check port conflicts:
Permission Denied Errors¶
Problem: Docker permission errors (Linux)
Solution:
# Add user to docker group
sudo usermod -aG docker $USER
# Apply group changes
newgrp docker
# Restart Docker service
sudo systemctl restart docker
# Test
docker ps
Volume Mount Issues¶
Problem: Code changes not reflected in container
Solutions:
-
Check volume mounts:
-
Restart containers:
-
Use bind mount (macOS):
API Issues¶
401 Unauthorized¶
Problem: API requests return 401
Solutions:
-
Check API key:
-
Check JWT token:
-
Verify environment variables:
429 Rate Limit Exceeded¶
Problem: Too many requests
Solutions:
-
Wait and retry:
-
Reduce request rate:
-
Use pagination:
CORS Errors¶
Problem: Browser blocks requests
Solutions:
-
Check CORS configuration:
-
Use proxy in development:
Development Issues¶
Tests Failing¶
Problem: pytest or jest tests fail
Solutions:
-
Backend tests:
-
Frontend tests:
-
Check test environment:
Git Conflicts¶
Problem: Merge conflicts when pulling changes
Solutions:
-
Stash your changes:
-
Use merge tool:
Debugging Issues¶
Problem: Can't figure out why something isn't working
Solutions:
-
Enable verbose logging:
-
Use debugger:
Backend (Python):
Frontend (JavaScript):
- Check logs:
Performance Issues¶
Slow Search Queries¶
Problem: Search takes >5 seconds
Solutions:
-
Check indexes:
-
Optimize query:
-
Check database performance:
High Memory Usage¶
Problem: Backend using too much memory
Solutions:
-
Check for memory leaks:
-
Reduce workers:
-
Optimize caching:
Getting Help¶
Before Asking for Help¶
- Check this troubleshooting guide
- Search existing issues on GitHub
- Check documentation in docs/ directory
- Review error messages carefully
- Try to isolate the problem
How to Ask for Help¶
When opening an issue or asking for help, include:
- Clear description of the problem
- Steps to reproduce the issue
- Expected vs actual behavior
- Environment information:
- Error messages (full stack trace)
- What you've tried already
Where to Get Help¶
- GitHub Issues: Bug reports
- GitHub Discussions: Questions and discussions
- Documentation: See docs/ directory
- Code Comments: Review inline documentation
Emergency Fixes¶
If nothing works, try the nuclear option:
# Stop everything
docker compose down -v
# Clean everything
rm -rf backend/.venv backend/__pycache__
rm -rf frontend/node_modules frontend/.next
# Reinstall
cd backend && poetry install && cd ..
cd frontend && npm install && cd ..
# Restart
docker compose -f docker-compose.dev.yml up --build
For more information: - DEVELOPER_ONBOARDING.md - Setup guide - ARCHITECTURE.md - System architecture - CONTRIBUTING.md - Contribution guidelines