Guides
Errors
How to handle route errors and per-provider quote errors
The /routes endpoint can return two kinds of errors:
- Route errors are returned when the request can't produce any quotes at all. The response is a
400 Bad Requestwith a single error object in the body — noresultsare returned. - Quote errors are returned when the request itself is valid but an individual provider can't return a quote. They appear on the
resultfield of a single entry inresults, alongside quotes from other providers that succeeded.
In both cases, the error object has a type field identifying the specific error.
Route Errors
Route errors are thrown when no quotes can be returned. The /routes request fails with 400 Bad Request and the body is one of the following objects.
Paused
The route between these chains is temporarily paused.
{
"type": "Paused"
}Disabled
The route between these chains has been disabled and is not currently available.
{
"type": "Disabled"
}BridgeAmountUsdTooLarge
The requested amount exceeds the maximum USD value permitted for this route. Includes the requested amountUsd and the maximumUsd allowed.
{
"type": "BridgeAmountUsdTooLarge",
"amountUsd": 1500000,
"maximumUsd": 1000000
}Quote Errors
Quote errors live on the result field of an individual entry in results. Other providers in the same response may still return valid quotes.
You can distinguish a quote from a quote error by checking for the presence of initiatingTransaction on result — if it's there, it's a quote. See Routes vs. Quotes for more detail.
GenericError
A catch-all error for unexpected failures. Includes an error field with a message.
{
"type": "GenericError",
"error": "Something went wrong"
}AmountTooSmall
The requested amount is below the minimum supported by this provider. May include a minimum field with the smallest acceptable amount, but this is not always available.
{
"type": "AmountTooSmall",
"minimum": "1000000"
}AmountTooLarge
The requested amount exceeds the maximum supported by this provider. May include a maximum field with the largest acceptable amount, but this is not always available.
{
"type": "AmountTooLarge",
"maximum": "1000000000000000000000"
}PriceImpactTooHigh
The quote's price impact exceeds the maximum accepted. Includes the observed priceImpactPercent and the maximumPriceImpactPercent allowed.
{
"type": "PriceImpactTooHigh",
"priceImpactPercent": 12.5,
"maximumPriceImpactPercent": 10
}Paused
This provider is temporarily paused for this route.
{
"type": "Paused"
}Disabled
This provider has been disabled for this route.
{
"type": "Disabled"
}ERC777MintToSmartContract
The requested token is an ERC-777 and the recipient is a smart contract, which this provider doesn't support.
{
"type": "ERC777MintToSmartContract"
}