# Check Python version and locationpython --versionpython3 --versionwhich pythonwhich python3# Check virtual environmentecho $VIRTUAL_ENVpip list | head -10
Solutions:
Use Python 3 Explicitly
Fix Virtual Environment
Use pyenv (Recommended)
# Create alias (temporary)alias python=python3alias pip=pip3# Or use python3 directlypython3 -m venv venvsource venv/bin/activatepython3 -m pip install -r api/requirements.txt
# Check Node.js and npm versionsnode --versionnpm --version# Check package.json requirementsgrep -A 5 -B 5 "engines" package.json# Check installed packagesnpm list --depth=0
Solutions:
Update Node.js
Use Yarn Instead
Docker Alternative
# Using Node Version Manager (recommended)curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.39.0/install.sh | bashsource ~/.bashrcnvm install 18nvm use 18# Verify versionnode --version # Should show v18.x.x# Reinstall dependenciesrm -rf node_modules package-lock.jsonnpm install
# Install Yarnnpm install -g yarn# Clear npm cache and use Yarnrm -rf node_modules package-lock.jsonyarn installyarn dev
# Use Node.js in Docker to avoid version conflictsdocker run -it --rm \ -v $(pwd):/app \ -w /app \ -p 3000:3000 \ node:18-alpine \ sh -c "npm install && npm run dev"
npm Permission Errors
Symptoms:
npm ERR! EACCES: permission denied
cannot run in wd errors
Global package installation failures
Solutions:
Fix npm Permissions
Use Node Version Manager
# Set npm global directory to user foldermkdir ~/.npm-globalnpm config set prefix '~/.npm-global'# Add to PATH (add to ~/.bashrc or ~/.zshrc)export PATH=~/.npm-global/bin:$PATHsource ~/.bashrc# Reinstall packagesnpm install -g npm@latest
# Install nvm (handles permissions automatically)curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.39.0/install.sh | bashsource ~/.bashrc# Install and use Node.jsnvm install 18nvm use 18nvm alias default 18# Now npm will work without sudonpm install -g npm@latest
# Check if process is runningps aux | grep python | grep api# Check port availabilitynetstat -tulpn | grep 8001# Orlsof -i :8001# Check API logstail -f ./api/logs/application.log# Test direct Python executioncd api && python main.py
Solutions:
Port Conflicts
Missing Dependencies
Configuration Issues
# Kill process using port 8001sudo lsof -ti:8001 | xargs sudo kill -9# Or use different portexport PORT=8002python -m api.main# Update frontend configuration# In .env or next.config.js:# SERVER_BASE_URL=http://localhost:8002
# Ensure virtual environment is activatedsource venv/bin/activate# Check if all dependencies are installedpip check# Reinstall requirementspip install --force-reinstall -r api/requirements.txt# Start with verbose loggingLOG_LEVEL=DEBUG python -m api.main
# Check environment variablespython -c "import osfrom dotenv import load_dotenvload_dotenv()print('GOOGLE_API_KEY:', 'SET' if os.getenv('GOOGLE_API_KEY') else 'NOT SET')print('OPENAI_API_KEY:', 'SET' if os.getenv('OPENAI_API_KEY') else 'NOT SET')print('PORT:', os.getenv('PORT', '8001'))"# Verify .env file exists and is readablels -la .envcat .env | grep -v "API_KEY" # Don't show actual keys
Frontend Connection Issues
Symptoms:
Frontend loads but can’t connect to API
CORS errors in browser console
Network request failures
Diagnosis:
# Check if frontend is runningcurl -I http://localhost:3000# Check browser console for errors# Open Developer Tools → Console# Test API from command linecurl -v http://localhost:8001/health# Check frontend configurationgrep -r "localhost:8001" src/grep -r "SERVER_BASE_URL" .
Solutions:
CORS Configuration
API URL Configuration
Network Debugging
# In api/api.py, ensure CORS is configured:app.add_middleware( CORSMiddleware, allow_origins=["*"], # In production, specify exact origins allow_credentials=True, allow_methods=["*"], allow_headers=["*"],)
// In next.config.js or environmentconst nextConfig = { env: { API_BASE_URL: process.env.SERVER_BASE_URL || 'http://localhost:8001' }}// Or in .env.localSERVER_BASE_URL=http://localhost:8001
# Test network connectivitycurl -v http://localhost:8001/health# Check firewall settingssudo ufw status # Linux# Or check Windows Firewall/macOS Firewall# Test from different terminal/shelltelnet localhost 8001
# Verify key is activecurl "https://generativelanguage.googleapis.com/v1/models?key=$GOOGLE_API_KEY"# Common issues:# 1. Key not enabled for Generative AI API# 2. Billing not enabled# 3. Key restrictions (IP/referrer)# Fix: Go to Google Cloud Console# Enable Generative AI API# Check API key restrictions
# Test key validitycurl https://api.openai.com/v1/models \ -H "Authorization: Bearer $OPENAI_API_KEY"# Common issues:# 1. Account needs billing setup# 2. Key expired or revoked# 3. Rate limits exceeded# Fix: Check OpenAI dashboard# Add payment method# Generate new key if needed
# Ensure .env is being loadedpython -c "from dotenv import load_dotenvimport osload_dotenv()print('.env file loaded')print('Keys found:', [k for k in os.environ if 'API_KEY' in k])"# Check file permissionsls -la .env# Verify no BOM or special charactersfile .envhexdump -C .env | head -5
Rate Limiting Issues
Symptoms:
“Too many requests” errors
Slow or hanging generation
HTTP 429 responses
Diagnosis:
# Check current usagecurl -s http://localhost:8001/auth/status | jq '.providers'# Monitor API logs for rate limit messagestail -f ./api/logs/application.log | grep -i "rate"# Test with small repository firstcurl -X POST "http://localhost:8001/wiki/generate" \ -d '{"repo_url": "https://github.com/octocat/Hello-World"}'
Solutions:
Adjust Rate Limits
Use Multiple Providers
Optimize Requests
# In api configurationRATE_LIMIT_CONFIG = { "google": { "requests_per_minute": 12, # Under 15 limit "retry_delay": 5, "backoff_factor": 2 }, "openai": { "requests_per_minute": 45, # Under 50 limit "retry_delay": 10 }}
# Test repository access manuallygit clone https://github.com/user/repo.git test-clonerm -rf test-clone# For private repos, test with tokengit clone https://token@github.com/user/private-repo.git# Check repository URL formatecho "https://github.com/microsoft/vscode" | \ grep -E "^https://(github|gitlab|bitbucket)\.(com|org)/.+/.+$"
Solutions:
Public Repository Issues
Private Repository Setup
GitLab/BitBucket
# Verify repository exists and is publiccurl -s https://api.github.com/repos/microsoft/vscode# Check for typos in URL# Correct: https://github.com/microsoft/vscode# Wrong: https://github.com/Microsoft/VSCode
# GitHub personal access token# 1. Go to Settings → Developer settings → Personal access tokens# 2. Generate token with 'repo' scope# 3. Use in request:curl -X POST "http://localhost:8001/wiki/generate" \ -d '{ "repo_url": "https://github.com/company/private-repo", "access_token": "ghp_xxxxxxxxxxxxxxxxxxxx", "model_provider": "google" }'
# Check generation progresscurl -s http://localhost:8001/wiki/projects | jq '.[].status'# Monitor resource usage during generationtop -p $(pgrep -f "python.*api")free -hdf -h# Check for specific timeout errorsgrep -i timeout ./api/logs/application.log
Solutions:
Increase Timeouts
Optimize Large Repositories
Resource Monitoring
# In API configurationGENERATION_TIMEOUT = 1800 # 30 minutesREQUEST_TIMEOUT = 300 # 5 minutes per API callCLONE_TIMEOUT = 600 # 10 minutes for repository clone