Skip to main content
Voltaire providers reject request() promises with errors matching the EIP-1193 / JSON-RPC 2.0 shape { code: number, message: string, data?: unknown }. @tevm/voltaire/provider exports ProviderRpcError, EIP1193ErrorCode, JsonRpcErrorCode, and ProviderRpcErrorCode. Source: ProviderRpcError.ts, types.ts.

Error Class and Constants

HttpProvider throws plain RpcError objects ({ code, message, data? }) directly from JSON-RPC responses and HTTP failures rather than instanceof ProviderRpcError. Always check error properties with a type guard (isRpcError) instead of relying solely on instanceof.

Error Code Reference

JSON-RPC 2.0 Codes (JsonRpcErrorCode)

EIP-1193 Wallet & Provider Codes (EIP1193ErrorCode)

EIP-1474 Ethereum Execution Codes

Handling Contract Reverts

Contract reverts surface with code === 3 or code === -32000, often carrying ABI-encoded revert bytes in error.data (for example 0x08c379a0... for Error(string) or a 4-byte custom error selector):

Retry Classification with retryWithBackoff

Combine isRpcError with retryWithBackoff from @tevm/voltaire/utils so permanent errors fail immediately while rate limits (-32005) and transient server failures (-32603, -32002) back off exponentially: