Diagnose and resolve common issues
This guide helps you diagnose and resolve common issues with the auto-trading system.
# 1. Check Docker status
docker --version
docker ps
# 2. Check bot status
./scripts/monitor-bots.sh
# 3. Check proxy status
./scripts/monitor-proxy.sh
# 4. Check recent logs
docker logs freqtrade-YourStrategy --tail 50
bash: docker: command not found
Solution: Install Docker following requirements guide
ERROR: Got permission denied while trying to connect to Docker daemon
Solutions:
# Add user to docker group
sudo usermod -aG docker $USER
# Logout and login again, or run:
newgrp docker
# Test access
docker run hello-world
Cannot connect to the Docker daemon
Solutions:
# Ubuntu/Debian
sudo systemctl start docker
sudo systemctl enable docker
# macOS/Windows
# Start Docker Desktop application
bash: ./docker-launch.sh: Permission denied
Solution:
chmod +x docker-launch.sh
chmod +x scripts/*.sh
bash: ./docker-launch.sh: No such file or directory
Solution:
# Ensure you're in the project directory
cd auto-trading
ls -la docker-launch.sh
# If missing, check git clone was successful
git status
ERROR: Environment variable BINANCE_API_KEY not set
Solution:
# Create from template
cp .env.sample .env
# Edit with your values
nano .env
ERROR: Unable to authenticate with exchange
Solutions:
# Basic API test
curl "https://api.binance.com/api/v3/account" \
-H "X-MBX-APIKEY: your_api_key"
ERROR: Telegram token invalid
Solutions:
curl "https://api.telegram.org/bot$TELEGRAM_BOT_TOKEN/getMe"
ERROR: Expecting ',' delimiter
Solution:
# Validate JSON syntax
cat config/your-config.json | jq .
# Common fixes:
# - Add missing commas between elements
# - Remove trailing commas before closing braces
# - Ensure proper quote matching
ERROR: 'max_open_trades' must be integer
Solution: Check parameter types in configuration reference
ERROR: Port 8101 already in use
Solutions:
# Find process using port
sudo lsof -i :8101
# Kill process if safe
sudo kill -9 PID
# Or use different port offset
./docker-launch.sh YourStrategy 1 # Uses port 8102
# Check all used ports
docker ps --format "table \t"
# Stop all freqtrade containers
docker stop $(docker ps -q --filter name=freqtrade)
CONTAINER STATUS: Exited (1)
Diagnosis:
# Check container logs
docker logs freqtrade-YourStrategy
# Look for specific error messages
docker logs freqtrade-YourStrategy 2>&1 | grep -i error
Common causes:
Solutions:
# Remove existing container
docker rm freqtrade-YourStrategy
# Clean up orphaned containers
docker container prune
# Restart with fresh container
./docker-launch.sh YourStrategy
ERROR: Impossible to load strategy 'YourStrategy'
Solutions:
# List available strategies
ls user_data/strategies/
# Update strategies
./scripts/update-strategies.sh
# Check strategy name in logs
docker logs freqtrade-YourStrategy | grep -i strategy
ERROR: Could not import strategy
Solutions:
docker pull freqtradeorg/freqtrade:latest
Diagnosis checklist:
# 1. Check if strategy generates signals
docker logs freqtrade-YourStrategy | grep -i "enter\|exit\|signal"
# 2. Verify sufficient balance
# Check web interface balance tab
# 3. Confirm trading pairs are active
# Check exchange for pair availability
# 4. Review market conditions
# Strategy may not match current market state
Common causes:
ERROR: Insufficient balance for trade
Solutions:
ERROR: Rate limit exceeded, retrying
Solutions:
# 1. Ensure proxy is running
./scripts/setup-proxy.sh
# 2. Check proxy status
./scripts/monitor-proxy.sh
# 3. Verify proxy configuration in templates
grep -r "binance-proxy" config/
ERROR: Connection timeout
Solutions:
curl "https://api.binance.com/api/v3/ping"
# Check memory usage
docker stats --no-stream
# If memory usage > 1GB per container:
# 1. Reduce number of concurrent strategies
# 2. Increase system RAM
# 3. Optimize configuration parameters
Causes and solutions:
process_throttle_secs
# Check disk usage
df -h
du -sh /your-data-directory/*
# Clean up logs
find /your-data-directory -name "*.log" -mtime +7 -delete
# Compress old databases
./scripts/backup.sh
Solutions:
docker restart freqtrade-YourStrategy
docker stats freqtrade-YourStrategy
{
"internals": {
"sd_notify": false,
"heartbeat_interval": 60
}
}
ERROR: Database disk image is malformed
Solutions:
# 1. Stop the affected bot
docker stop freqtrade-YourStrategy
# 2. Backup current database
cp /data-dir/YourStrategy/user_data/tradesv3-YourStrategy.sqlite \
/backup/tradesv3-YourStrategy-backup.sqlite
# 3. Attempt repair
sqlite3 /data-dir/YourStrategy/user_data/tradesv3-YourStrategy.sqlite \
".recover" | sqlite3 /data-dir/YourStrategy/user_data/tradesv3-YourStrategy-recovered.sqlite
# 4. Replace database and restart
mv /data-dir/YourStrategy/user_data/tradesv3-YourStrategy-recovered.sqlite \
/data-dir/YourStrategy/user_data/tradesv3-YourStrategy.sqlite
./docker-launch.sh YourStrategy
ERROR: Database is locked
Solutions:
# 1. Stop all bots accessing the database
docker stop freqtrade-YourStrategy
# 2. Check for orphaned processes
ps aux | grep freqtrade
# 3. Remove lock file if exists
rm -f /data-dir/YourStrategy/user_data/tradesv3-YourStrategy.sqlite-wal
rm -f /data-dir/YourStrategy/user_data/tradesv3-YourStrategy.sqlite-shm
# 4. Restart bot
./docker-launch.sh YourStrategy
# Check if proxy container is running
docker ps | grep binance-proxy
# If not running, restart
./scripts/setup-proxy.sh
# Test proxy connectivity
curl http://localhost:8100/api/v3/ping
# Check proxy logs
docker logs binance-proxy
# Monitor proxy metrics
curl http://localhost:8100/metrics
# Restart proxy if needed
docker restart binance-proxy
ERROR: Name resolution failed
Solutions:
# Test DNS resolution
nslookup api.binance.com
# Check Docker DNS
docker run --rm alpine nslookup api.binance.com
# Restart Docker if needed
sudo systemctl restart docker
Diagnosis:
# Test bot token
curl "https://api.telegram.org/bot$TELEGRAM_BOT_TOKEN/getMe"
# Check bot logs for Telegram errors
docker logs freqtrade-YourStrategy | grep -i telegram
Common causes:
Connection refused to localhost:8101
Solutions:
# 1. Check if container is running
docker ps | grep freqtrade
# 2. Verify port mapping
docker port freqtrade-YourStrategy
# 3. Test local connection
curl http://localhost:8101/api/v1/ping
# 4. Check firewall settings
sudo ufw status
Solutions:
# Stop all freqtrade containers
docker stop $(docker ps -q --filter name=freqtrade)
# Verify all stopped
docker ps --filter name=freqtrade
# Cancel open orders (if needed)
# Access Binance web interface to manually close positions
# 1. Backup current state
./scripts/backup.sh
# 2. Stop all containers
docker stop $(docker ps -q)
# 3. Clean up Docker system
docker system prune -f
# 4. Restart services
./scripts/setup-proxy.sh
./docker-launch.sh YourStrategy
# 5. Verify recovery
./scripts/monitor-bots.sh
# Comprehensive log review
docker logs freqtrade-YourStrategy > bot.log 2>&1
# Search for specific errors
grep -i "error\|exception\|failed" bot.log
# Check for patterns
grep -E "bought|sold|profit|loss" bot.log | tail -20
When reporting issues, include:
# Weekly checks
./scripts/monitor-bots.sh
./scripts/backup.sh
docker system df # Check disk usage
# Monthly tasks
./scripts/update-strategies.sh
# Review and rotate API keys
# Analyze performance and adjust configurations
# Set up automated health checks
# Add to crontab:
# */10 * * * * /path/to/scripts/health-check.sh
# Set up log rotation
# Configure logrotate for Docker logs
# Monitor disk space
# Set up alerts for disk usage > 80%
After resolving issues: