Troubleshooting Guide
Common issues and solutions when running the Wealth trading bot.
Table of Contents
- Authentication Errors
- Timestamp Errors
- Insufficient Balance
- Rate Limiting
- WebSocket Issues
- Connection Issues
- Configuration Issues
- Getting Help
Authentication Errors
Error: Binance API error (status=401, code=-2015): Invalid API-key
Causes:
- Incorrect API key or secret
- API key not enabled for futures trading
- IP address not whitelisted
- API key expired or revoked
Solutions:
-
Verify API key is correct:
wealth config show -
Check IP whitelist on your exchange (Binance → API Management → Edit API)
-
Ensure API permissions include "Futures Trading"
-
Regenerate keys if unsure and update configuration
Prevention:
- Use encrypted credentials instead of environment variables
- Enable IP whitelisting after creating API keys
- Test on testnet before live trading
Timestamp Errors
Error: Binance API error (status=400, code=-1021): Timestamp out of sync
Causes:
- System clock drift
- NTP service not running
- Network latency issues
Solutions:
# Sync system clock with NTP
sudo ntpdate -s time.nist.gov
# Or use systemd-timesyncd
sudo systemctl restart systemd-timesyncd
sudo timedatectl status
# Install chrony (recommended for production)
sudo apt install chrony
sudo systemctl enable chrony
sudo systemctl start chrony
Verification:
timedatectl
# Should show: System clock synchronized: yes
Insufficient Balance
Error: Binance API error (status=400, code=-2019): Margin insufficient
Causes:
- Insufficient USDT in futures wallet
- Existing positions using available margin
- Position size exceeds available balance
Solutions:
-
Check current balance:
wealth balance -
Transfer funds to your futures wallet on the exchange
-
Reduce position size in
config.toml:[trading] max_position_usd = 5000 # Lower this value -
Close existing positions if needed:
wealth close --all
Rate Limiting
Error: Rate limit exceeded or 429 Too Many Requests
Causes:
- Too many API requests in short time
- Aggressive polling settings
- Multiple bot instances sharing API keys
Solutions:
-
Wait and retry - Rate limits typically reset in 1-5 minutes
-
Check for multiple instances:
ps aux | grep wealth -
Upgrade exchange tier for higher limits (Binance VIP, Bybit API tier)
-
Spread API keys across different bots if running multiple
WebSocket Issues
Error: WebSocket connection failed or WebSocket disconnected
Causes:
- Unstable internet connection
- Firewall blocking WebSocket connections
- Exchange maintenance
Solutions:
-
Check internet connection:
ping fapi.binance.com ping api.bybit.com -
Allow WebSocket connections through firewall (port 443)
-
Check exchange status:
- Binance: https://www.binance.com/en/support/announcement
- Bybit: https://announcements.bybit.com/
-
Restart the bot - It auto-reconnects, but a restart ensures clean state:
# Stop with Ctrl+C, then restart wealth run
Connection Issues
Error: Failed to connect to exchange or Network error
Causes:
- DNS resolution failure
- Network timeout
- Exchange API down
Solutions:
-
Test connectivity:
curl -I https://fapi.binance.com curl -I https://api.bybit.com curl -I https://api.hyperliquid.xyz -
Check DNS:
nslookup fapi.binance.com -
Use alternative DNS (Google: 8.8.8.8, Cloudflare: 1.1.1.1)
Configuration Issues
Error: Configuration validation failed
Solutions:
-
Validate configuration:
wealth verify -
Check config file syntax:
cat config.toml -
Use example config as reference:
cp config.example.toml config.toml # Then edit with your values
Credential Issues
Error: Failed to decrypt credentials
Causes:
- Wrong passphrase
- Missing credentials file
- Corrupted credentials file
Solutions:
-
Verify passphrase is set correctly:
echo $CREDENTIALS_PASSPHRASE -
Check credentials file exists:
ls -la credentials.encrypted.json -
Re-create credentials if corrupted:
export CREDENTIALS_PASSPHRASE="your_passphrase" wealth credentials create wealth credentials add binance YOUR_KEY YOUR_SECRET wealth credentials verify
Health Check
Quick diagnostic commands:
# Check bot health
curl http://localhost:9090/health | jq
# Check positions
wealth positions
# Check balances
wealth balance
# Verify configuration
wealth verify
# View current config
wealth config
Common Log Messages
Normal Operation
Initializing bot | mode=paper_trading- Starting in paper modeWebSocket connected- Exchange connection establishedBot running | metrics_port=9090- Bot is operational
Warnings (Usually OK)
Opportunity detected but spread too low- Normal filteringSkipping execution: insufficient balance- Not enough funds for tradeRate limit approaching- Consider reducing activity
Errors (Need Attention)
Authentication failed- Check API credentialsOrder placement failed- Check balance and configurationWebSocket disconnected- Network issue, will auto-reconnect
Getting Help
If you can't resolve an issue:
-
Check logs for detailed error messages:
wealth run --verbose 2>&1 | tee bot.log -
Collect diagnostic info:
wealth --version wealth verify curl http://localhost:9090/health -
Test in paper mode first:
export WEALTH__EXECUTION__MODE=paper wealth run
See Also
- Configuration Guide - Settings reference
- Security Guide - Credential management
- Getting Started - Initial setup