Skip to main content

Overview

Fibrous Router API uses standard HTTP status codes and provides detailed error messages to help you understand and resolve issues. All error responses follow a consistent format.

Error Response Format

All error responses follow this structure:

HTTP Status Codes

The API uses standard HTTP status codes to indicate the type of error:

Error Codes

400 Bad Request

Bad Request errors occur when the request parameters are invalid or validation fails.

Token Same Error

Error Code: 400
Message: Token in and token out cannot be the same
Description: The input token and output token addresses are identical. Example:
Solution: Ensure tokenInAddress and tokenOutAddress are different addresses.

Integrator Fee and Surplus Percentage Conflict

Error Code: 400
Message: Integrator fee and integrator surplus percentage cannot be provided together
Description: You cannot specify both integratorFeePercentageBps and integratorSurplusPercentageBps in the same request. Example:
Solution: Use either integratorFeePercentageBps OR integratorSurplusPercentageBps, but not both.

Validation Errors

Validation errors occur when request parameters don’t meet the required format or constraints: Common Validation Errors: Example Validation Error:
Solution: Review the validation rules for each parameter and ensure your request meets all requirements.

Invalid Route

Error Code: 400
Message: Invalid route or custom error message
Description: The provided route is invalid, expired, or cannot be processed. Example:
Solution: Fetch a fresh route from the /route endpoint before generating calldata.

429 Too Many Requests

Error Code: 429
Message: ThrottlerException: Too Many Requests
Description: You have exceeded the rate limit for API requests. The default rate limit is 200 requests per minute. Example:
Response Headers:
  • X-RateLimit-Limit: Maximum number of requests allowed
  • X-RateLimit-Remaining: Number of requests remaining in the current window
  • X-RateLimit-Reset: Time when the rate limit resets (Unix timestamp)
  • Retry-After: Seconds to wait before retrying
Solution:
  • Wait for the rate limit to reset (check Retry-After header)
  • Implement exponential backoff in your retry logic
  • Generate and manage your API keys at the Fibrous Partnership Portal for higher rate limits
  • Contact contact@fibrous.finance for enterprise rate limits
API keys provide higher rate limits. Generate and manage your API keys at the Fibrous Partnership Portal.

500 Internal Server Error

Error Code: 500
Message: Internal server error
Description: An unexpected error occurred on the server side. This could be due to:
  • Temporary service unavailability
  • Database connectivity issues
  • Internal processing errors
Example:
Solution:

Error Handling Best Practices

1. Check Status Codes

Always check the HTTP status code before processing the response:

2. Handle Rate Limiting

Implement exponential backoff for rate limit errors:

3. Validate Input Before Request

Validate parameters before making API calls to avoid unnecessary requests:

4. Handle Validation Errors

Validation errors may return an array of error messages:

5. Log Errors for Debugging

Log error details for debugging while being careful not to expose sensitive information:

Common Error Scenarios

Scenario 1: Invalid Token Address

Request:
Response:
Fix: Use a valid Ethereum address format (0x followed by 40 hex characters).

Scenario 2: Same Token Addresses

Request:
Response:
Fix: Use different addresses for input and output tokens.

Scenario 3: Rate Limit Exceeded

Request: Multiple rapid requests Response:
Fix: Implement rate limiting in your application or obtain an API key from the Fibrous Partnership Portal for higher limits.

Scenario 4: Missing Required Parameters

Request:
Response:
Fix: Include all required parameters in your request.

Error Codes Summary

  • Token addresses are the same
  • Invalid Ethereum address format
  • Missing required parameters
  • Invalid parameter values (out of range, wrong type)
  • Integrator parameter conflicts
  • Route amount exceeds maximum
  • Invalid route provided
  • Rate limit exceeded
  • Too many requests in a short time period
  • Server-side processing error
  • Temporary service unavailability
  • Database connectivity issues

Getting Help

If you encounter errors that aren’t covered in this documentation:
  1. Check the Error Message: The error message usually provides specific information about what went wrong
  2. Review Request Parameters: Ensure all parameters meet the validation requirements
  3. Check Service Status: Visit our Status Page
  4. Contact Support: