Troubleshooting
Solutions to common issues you may encounter with Nexgent.
Startup Issues
Backend won't start
Error: DATABASE_URL is not defined
# Solution: Ensure .env file exists and is properly configured
cp .env.example .env
# Edit .env with your valuesError: Can't reach database server
# Check PostgreSQL is running
docker ps | grep postgres
# Verify connection string
psql $DATABASE_URL -c "SELECT 1"Error: Redis connection refused
# Check Redis is running
docker ps | grep redis
# Test connection
redis-cli -h localhost -p 6379 pingFrontend won't start
Error: NEXTAUTH_SECRET must be at least 32 characters
# Generate a proper secret
pnpm --filter frontend generate-secret
# Copy output to .env.localError: Invalid NEXTAUTH_URL
# Ensure URL matches your setup
NEXTAUTH_URL=http://localhost:3000 # Development
NEXTAUTH_URL=https://yourdomain.com # ProductionPort already in use
# Kill process on port 4000 (backend)
npx kill-port 4000
# Kill process on port 3000 (frontend)
npx kill-port 3000
# Or use the cleanup script
pnpm cleanup:ports:forceDatabase Issues
Migrations failing
Error: Migration failed to apply cleanly
# Reset database (WARNING: deletes all data)
pnpm --filter backend db:push --force-reset
# Or create fresh migration
pnpm --filter backend db:migrateError: Prisma client out of sync
# Regenerate Prisma client
pnpm --filter backend db:generateCan't connect to database
- Check PostgreSQL is running
- Verify DATABASE_URL format:
postgresql://USER:PASSWORD@HOST:PORT/DATABASE - Check firewall/network access
- Verify credentials are correct
Data not persisting
Check that you're using the correct database:
# Verify DATABASE_URL points to expected database
echo $DATABASE_URL
# Check database exists
psql -h localhost -U postgres -lRedis Issues
Cache not working
Symptoms: Slow queries, stale data
# Check Redis connection
pnpm --filter backend cache:status
# Reset cache
pnpm --filter backend cache:reset
# Warm cache
pnpm --filter backend cache:warmupRedis connection timeout
# Check if Redis is reachable
redis-cli -h $REDIS_HOST -p $REDIS_PORT ping
# Check for max connections
redis-cli INFO clientsOut of memory
# Check Redis memory usage
redis-cli INFO memory
# Set max memory policy (in redis.conf)
maxmemory 256mb
maxmemory-policy allkeys-lruTrading Issues
Agent not executing trades
Checklist:
| Check | Solution |
|---|---|
| Agent is active | Enable in dashboard |
| Sufficient balance | Add funds to wallet |
| No existing position | Close position or wait |
| Signal meets threshold | Lower score threshold |
| Wallet loaded | Check startup logs |
Debug steps:
# Check agent status via API
curl http://localhost:4000/api/v1/agents \
-H "Authorization: Bearer <token>"
# Check wallet is loaded (look for startup log)
# "Loaded wallet: ABC123..."Balance showing 0 or incorrect
# 1. Verify on-chain balance
solana balance <wallet-address> --url <rpc-url>
# 2. Check wallet is configured
grep WALLET_ .env
# 3. Reset balance cache
pnpm --filter backend cache:resetTrades failing with slippage error
Error: Slippage tolerance exceeded
Solutions:
- Increase slippage in trade config
- Reduce trade size
- Avoid low-liquidity tokens
- Try during lower-traffic periods
Stop loss not triggering
Checklist:
- Stop loss is enabled in agent config
- Price feed is working (check Pyth connection)
- Position exists and is active
- Price has actually crossed threshold
# Check price service status
curl http://localhost:4000/api/v1/prices/sol-usdDCA not triggering
Checklist:
- DCA is enabled in agent config
- Position hasn't reached max DCA level
- Agent has sufficient balance for DCA buy
- Price has crossed DCA threshold
API Issues
401 Unauthorized
| Error | Cause | Solution |
|---|---|---|
Authorization header required | No token | Add Bearer token |
Invalid token | Malformed/wrong token | Check token format |
Token expired | Access token expired | Refresh token |
Invalid API key | Wrong/revoked key | Generate new key |
403 Forbidden
Error: API key missing required scope
Your API key doesn't have permission for this action. Generate a new key with the required scope (read, write, signals).
429 Too Many Requests
You've reached a limit. Wait and retry:
# Response includes retry time
{
"error": "Too many requests",
"retryAfter": 45
}Solutions:
- Implement exponential backoff
- Reduce request frequency
- Use API key for higher limits
500 Internal Server Error
Check backend logs for details:
# View logs
docker logs nexgent-backend
# Or if running directly
# Check terminal outputWebSocket Issues
Dashboard not updating in real-time
- Check WebSocket connection - Browser console shows connection status
- Check backend is running - WebSocket server starts with backend
- Check firewall - Port 4000 must be accessible
- Check proxy config - Nginx/reverse proxy must support WebSocket
Nginx WebSocket config:
location /ws {
proxy_pass http://localhost:4000;
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "upgrade";
}WebSocket disconnecting frequently
Possible causes:
- Network instability
- Proxy timeout settings
- Server resource constraints
Solutions:
- Increase proxy timeouts
- Check server resources
- Implement reconnection logic (built into dashboard)
Price Feed Issues
SOL/USD price not updating
Check Pyth connection:
# Test Pyth SSE endpoint
curl "https://hermes.pyth.network/v2/updates/price/stream?ids[]=0xef0d8b6fda2ceba41da15d4095d1da392a0d2f8ed0c6c7bc0f4cfac8c280b56d"Common causes:
- Network firewall blocking SSE
- Pyth service temporarily unavailable
- Invalid price feed ID
Token prices not loading
Check price provider:
# Test Jupiter price API
curl "https://lite-api.jup.ag/price/v2?ids=<token-address>"
# Or DexScreener
curl "https://api.dexscreener.com/tokens/v1/solana/<token-address>"If Jupiter fails:
- Check
JUPITER_API_KEYis valid - Try switching to DexScreener:
PRICE_PROVIDER=dexscreener
Performance Issues
Slow response times
- Check database queries - Enable query logging
- Check Redis connection - Ensure caching is working
- Check memory usage - May need more RAM
- Check CPU usage - May need more cores
# Monitor resource usage
docker statsHigh memory usage
# Check Node.js heap
node --max-old-space-size=2048 dist/index.js
# Check for memory leaks in logsDatabase connection exhaustion
# Check active connections
psql -c "SELECT count(*) FROM pg_stat_activity;"
# Increase pool size in DATABASE_URL or Prisma configCommon Error Messages
| Error | Meaning | Solution |
|---|---|---|
ECONNREFUSED | Can't connect to service | Check service is running |
ETIMEDOUT | Connection timed out | Check network/firewall |
ENOTFOUND | DNS resolution failed | Check hostname |
JWT_SECRET must be set | Missing env variable | Add to .env |
Invalid wallet address | Malformed Solana address | Check address format |
Getting Help
If you can't resolve your issue:
- Search existing issues - GitHub Issues (opens in a new tab)
- Check discussions - GitHub Discussions (opens in a new tab)
- Collect information:
- Error messages (full stack trace)
- Environment (OS, Node version)
- Steps to reproduce
- Relevant config (redact secrets!)
- Open a new issue with the information above