Skip to main content
Lasso normalizes all error responses to standard JSON-RPC 2.0 format, providing consistent error handling across all providers.

Error Response Format

All errors follow the JSON-RPC 2.0 specification:

Error Object Fields

Standard JSON-RPC Error Codes

Lasso implements the complete JSON-RPC 2.0 error code specification:

-32700: Parse Error

Meaning: Invalid JSON was received by the server. The request could not be parsed. Common Causes:
  • Malformed JSON syntax
  • Invalid UTF-8 encoding
  • Truncated request body
Example:

-32600: Invalid Request

Meaning: The JSON sent is not a valid Request object. Common Causes:
  • Missing required fields (jsonrpc, method, id)
  • Invalid field types
  • Batch request exceeds maximum size (default: 50)
  • Invalid jsonrpc version (must be “2.0”)
Examples:

-32601: Method Not Found

Meaning: The requested method does not exist or is not supported in the current context. Common Causes:
  • Method name typo
  • Subscription method called over HTTP (use WebSocket)
  • Blocked method (wallet, signing, filters)
  • Chain-specific method not available on requested chain
Examples:
When subscription methods are called over HTTP, Lasso provides the correct WebSocket URL in the data.websocket_url field, mirroring the HTTP request path structure.

-32602: Invalid Params

Meaning: Invalid method parameter(s). Common Causes:
  • Unsupported chain name or ID
  • Missing required parameters
  • Invalid parameter types or formats
  • Block number out of range
Examples:

-32603: Internal Error

Meaning: Internal JSON-RPC error. Typically indicates an upstream provider failure. Common Causes:
  • All providers failed (circuit breakers open)
  • Upstream provider returned an error
  • Timeout waiting for provider response
  • Network connectivity issues
Example:

-32000: Server Error

Meaning: Server-side error specific to Lasso’s operation. Common Causes:
  • Rate limit exceeded
  • Strategy access denied (profile restriction)
  • Quota exceeded
  • Provider override failed
  • Authentication failure
Examples: Rate Limiting:
When rate limited, use the retry_after_ms value in the error data to implement exponential backoff.
Authentication Failure:
Quota Exceeded:
Strategy Access Denied:

Batch Request Errors

When sending batch requests, each item in the response array contains either a result or error field: Request:
Response:

Provider-Specific Errors

Lasso normalizes upstream provider errors into standard JSON-RPC format. Original provider errors are preserved in the data field when available:

WebSocket Errors

WebSocket connections may receive errors in the same JSON-RPC format. Additionally, the connection may be closed with a specific close code:

WebSocket Close Codes

Heartbeat Timeout

Lasso sends WebSocket pings every 30 seconds. If no pong is received within 5 seconds, the connection will be closed after 2 missed heartbeats:

Error Handling Best Practices

Retry Strategy

Retryable Errors:
  • -32603 Internal Error (temporary upstream failure)
  • -32000 Rate Limit Exceeded (with exponential backoff)
  • -32000 Server Error (check data for specifics)
Non-Retryable Errors:
  • -32700 Parse Error (fix request format)
  • -32600 Invalid Request (fix request structure)
  • -32601 Method Not Found (use correct method/transport)
  • -32602 Invalid Params (fix parameters)

Exponential Backoff

For rate limit errors, implement exponential backoff using retry_after_ms:

Circuit Breaker Awareness

When all providers fail with circuit breakers open, consider:
  • Switching to a different chain if available
  • Implementing client-side caching for recent data
  • Showing user-friendly error messages
  • Monitoring circuit breaker state via observability metadata

Error Logging

Always log the data field for debugging:

See Also