- Integrated all production features into main application flow - Added metrics, tracing, caching, and health checks to API server - Enhanced trade execution with circuit breakers and retry policies - Integrated database persistence for trades and metrics - Added structured logging and observability - Enhanced middleware with missing validators and rate limiters - Added comprehensive error handling and resilience patterns
4.5 KiB
Troubleshooting Guide
Common issues and solutions for the Immortal AI Trading Bot.
Table of Contents
- Bot Won't Start
- Database Connection Issues
- API Errors
- Trading Issues
- Performance Issues
- Memory/Storage Issues
Bot Won't Start
Symptom
Bot status shows as "stopped" or API returns errors when starting.
Solutions
-
Check Environment Variables
# Verify required variables are set echo $WALLET_PRIVATE_KEY echo $OPENROUTER_API_KEY echo $DATABASE_URL -
Check Logs
docker-compose logs backend | tail -50 -
Verify Wallet Balance
# Check if wallet has sufficient BNB curl http://localhost:3001/api/bot-status -
Check Database Connection
psql $DATABASE_URL -c "SELECT 1"
Database Connection Issues
Symptom
Errors like "Connection refused" or "ECONNREFUSED".
Solutions
-
Verify Database is Running
docker-compose ps postgres -
Check Connection String
# Format: postgresql://user:password@host:port/database echo $DATABASE_URL -
Test Connection
psql $DATABASE_URL -c "SELECT version()" -
Check Network
# If using Docker, ensure services are on same network docker network ls
API Errors
Symptom
API returns 500 errors or timeouts.
Solutions
-
Check Service Status
curl http://localhost:3001/health -
Review Error Logs
tail -f logs/error.log -
Check Rate Limiting
# Verify you're not hitting rate limits curl -v http://localhost:3001/api/bot-status -
Verify API Key
# Ensure API key is valid curl -H "X-API-Key: your-key" http://localhost:3001/api/bot-status
Trading Issues
Symptom
Bot is running but not executing trades.
Solutions
-
Check AI Confidence
- Low confidence decisions may result in HOLD
- Review AI decision logs
-
Verify Market Conditions
# Check if tokens have sufficient liquidity curl http://localhost:3001/api/discover-tokens -
Check Safeguards
- Verify trade amount limits
- Check stop-loss settings
- Review risk level
-
Review Trade Logs
curl http://localhost:3001/api/trade-logs?limit=10
Performance Issues
Symptom
Slow API responses or high latency.
Solutions
-
Check Database Performance
# Check for slow queries psql $DATABASE_URL -c " SELECT query, mean_exec_time FROM pg_stat_statements ORDER BY mean_exec_time DESC LIMIT 10; " -
Review Cache Hit Rate
# Check Redis stats redis-cli INFO stats -
Check System Resources
# CPU and memory usage docker stats -
Optimize Queries
- Add database indexes
- Review query patterns
- Enable query caching
Memory/Storage Issues
Symptom
Greenfield storage errors or memory sync failures.
Solutions
-
Verify Greenfield Connection
# Check Greenfield RPC echo $GREENFIELD_RPC_URL -
Check Bucket Access
# Verify bucket exists and is accessible echo $GREENFIELD_BUCKET_NAME -
Review Memory Sync Queue
# Check metrics curl http://localhost:3001/metrics | grep memory_sync -
Clear Sync Backlog
# If backlog is too large, may need to process manually # Check logs for sync errors
Common Error Messages
"Insufficient balance"
Solution: Add BNB to wallet
# Get testnet BNB from faucet
# Mainnet: Transfer BNB to wallet
"Rate limit exceeded"
Solution: Wait for rate limit window to reset or upgrade API plan
"Circuit breaker is OPEN"
Solution: External service is down. Wait for automatic recovery or check service status.
"Database connection timeout"
Solution:
- Check database is running
- Verify network connectivity
- Check connection pool settings
Getting Help
If issues persist:
- Check logs:
logs/error.logandlogs/combined.log - Review metrics:
http://localhost:3001/metrics - Check health:
http://localhost:3001/api/health - Contact support with:
- Error messages
- Log excerpts
- System configuration
- Steps to reproduce