Error Handling Reference
API Errors
DeFiLlama API Timeout
Error: Request timeoutCause: DeFiLlama API slow or unreachable Solution:
- Wait and retry (service usually recovers quickly)
- Check for outages
- Use cached data if available
Invalid Protocol Name
Error: Protocol not found: invalid-nameCause: Protocol slug doesn't match DeFiLlama database Solution:
- Check protocol list:
python onchain_analytics.py protocols - Use exact slug from DeFiLlama (case-sensitive)
- Search by partial name in protocol list
Empty Response
Error: No data returned for queryCause: Filter too restrictive or data unavailable Solution:
- Remove filters and retry
- Check if category/chain exists
- Try broader time range
Data Quality Issues
Missing TVL Data
Warning: TVL data unavailable for some protocolsCause: New protocols or data collection gaps Solution:
- Check DeFiLlama directly for protocol
- Data usually available within 24h of listing
Stale Data
Warning: Data may be stale (last updated: X hours ago)Cause: Cache not refreshed Solution:
- Clear cache:
rm ~/.onchain_analytics_cache.json - Use
--verboseto see cache status
Output Issues
Large Output Truncated
[Showing top 50 of 1000+ protocols]Solution: Use --limit flag or --format json for full data
Encoding Errors
UnicodeEncodeError: ...Solution:
- Use
--format json - Set
LANG=en_US.UTF-8
Recovery Strategies
Clear Cache
rm ~/.onchain_analytics_cache.jsonVerbose Mode for Debugging
python onchain_analytics.py protocols --verboseFallback to JSON
If table output fails:
python onchain_analytics.py protocols --format json > output.json