Error Codes
API error codes and their meanings
DexAggregator uses standard HTTP status codes along with custom error codes for more specific error handling.
HTTP Status Codes
200
Success
400
Bad Request - Invalid parameters
404
Not Found - Endpoint doesn't exist
500
Internal Server Error
503
Service Unavailable
Custom Error Codes
General Errors (1000-1099)
1000
Invalid chain
Chain identifier not supported
Use bsc or ethereum
1001
Invalid token address
Token address format invalid
Use checksummed 42-char address
1002
Invalid amount
Amount must be positive
Provide amount > 0 in wei
1003
Invalid slippage
Slippage out of range
Use 1-10000 basis points
1004
Invalid deadline
Deadline in the past
Use future Unix timestamp
Routing Errors (1100-1199)
1100
No route found
No swap path available
Check token pair availability
1101
KyberSwap API error
Failed to fetch from KyberSwap
Retry or check KyberSwap status
1102
Insufficient liquidity
Not enough liquidity for swap
Reduce swap amount
1103
No supported adapters
No DEX adapters match route
Check includedSources parameter
1104
Route transformation failed
Error processing route data
Report issue with request details
Encoding Errors (1200-1299)
1200
Encoding failed
Failed to encode calldata
Check swap parameters
1201
Invalid swap type
Swap type not recognized
Report issue
1202
Missing adapter address
Adapter contract not configured
Check chain configuration
Gas Estimation Errors (1300-1399)
1300
Gas estimation failed
On-chain gas simulation failed
Check RPC endpoint
1301
RPC connection error
Cannot connect to blockchain RPC
Verify RPC URL
Error Response Format
All errors follow this structure:
Handling Errors
JavaScript Example
Python Example
Common Issues and Solutions
Issue: "No route found"
Possible causes:
Token pair not supported
Insufficient liquidity
DEX sources filtered out
Solutions:
Verify both tokens exist on the chain
Check token pair liquidity on DEX
Remove
includedSourcesfilterReduce swap amount
Issue: "KyberSwap API error"
Possible causes:
KyberSwap API temporarily down
Rate limiting
Network connectivity
Solutions:
Implement exponential backoff retry
Check KyberSwap status page
Verify internet connectivity
Issue: "Invalid token address"
Possible causes:
Wrong address format
Missing
0xprefixIncorrect checksum
Solutions:
Issue: "Gas estimation failed"
Possible causes:
RPC endpoint down
Contract execution would revert
Insufficient balance
Solutions:
Verify RPC endpoint is responsive
Check wallet has sufficient balance
Verify token approval if needed
Debugging Tips
Reporting Issues
When reporting errors, please include:
Error code and message
Full request payload (remove private keys!)
Chain and token addresses
Timestamp
Server logs (if available)
Report issues on GitHub.
Need Help?
💬 Community support channels
Last updated