Skip to main content
Standardized error definitions for token contracts implementing ERC-20, ERC-721, and ERC-1155.
Implements ERC-6093 custom errors for common token operations.

Overview

ERC-6093 defines standard custom errors for token contracts, replacing generic require messages with structured errors containing relevant context. Benefits:
  • Gas efficiency (custom errors cheaper than strings)
  • Type-safe error handling
  • Standardized error names across implementations
  • Rich context for debugging

ERC-20 Errors

ERC20InsufficientBalance

Thrown when transfer amount exceeds sender’s balance. Example:

ERC20InsufficientAllowance

Thrown when transferFrom amount exceeds allowance.

ERC20InvalidSender / Receiver / Approver / Spender

Thrown for zero address or other invalid addresses.

ERC-721 Errors

ERC721NonexistentToken

Token doesn’t exist.

ERC721IncorrectOwner

Sender is not token owner.

ERC721InsufficientApproval

Operator not approved for token.

ERC-1155 Errors

ERC1155InsufficientBalance

Insufficient balance for token ID.

ERC1155InvalidArrayLength

Mismatch between ids and values array lengths in batch operations.

ERC1155MissingApprovalForAll

Operator not approved for all tokens.

Usage Patterns

Decoding Errors

Encoding for Testing

Specification

Defined in: src/primitives/Abi/error/standards/ See also: