Error Reference
Every Zama SDK error code, whether it is retryable, and how ShadowLine maps it to a message.
Use matchZamaError from @zama-fhe/sdk to classify SDK errors into user-friendly messages. ShadowLine re-exports this via the classifyError(err) utility in src/lib/errors.ts.
usage
import { matchZamaError } from '@zama-fhe/sdk';
try {
await shield({ amount });
} catch (err) {
const result = matchZamaError(err, {
SIGNING_REJECTED: () => ({ title: 'Declined', message: 'You cancelled the signature.' }),
INSUFFICIENT_ERC20_BALANCE: () => ({ title: 'Low Balance', message: 'Not enough tokens.' }),
_: (e) => ({ title: 'Error', message: e.message }),
});
showToast(result);
}| Error Code | Title | Description | Retry? |
|---|---|---|---|
SIGNING_REJECTED | Signature Declined | User declined the EIP-712 permit request in their wallet. | Retryable |
SIGNING_FAILED | Wallet Signing Failed | Wallet could not complete the signature — connection issue or wrong account. | Retryable |
ENCRYPTION_FAILED | Encryption Failed | FHE encryption failed client-side. Browser may not support WebAssembly. | Retryable |
DECRYPTION_FAILED | Decryption Failed | Session permit may have expired. Request a new permit. | Retryable |
TRANSACTION_REVERTED | Transaction Reverted | On-chain transaction reverted — check balance, allowance, or contract state. | Retryable |
INVALID_KEYPAIR | Session Key Rejected | Session key was rejected by the relayer. Generate a fresh key. | Retryable |
KEYPAIR_EXPIRED | Session Expired | Session key has expired. Sign again to refresh. | Retryable |
NO_CIPHERTEXT | No Confidential Balance | This account has no confidential balance for this wrapper. Shield first. | Terminal |
RELAYER_REQUEST_FAILED | Relayer Unavailable | Zama relayer is temporarily unavailable. Retry in a few seconds. | Retryable |
CONFIGURATION | Configuration Error | SDK misconfiguration — likely a bug in the integration. | Terminal |
INSUFFICIENT_CONFIDENTIAL_BALANCE | Insufficient Balance | Confidential balance is lower than the unshield/transfer amount. | Terminal |
INSUFFICIENT_ERC20_BALANCE | Insufficient Tokens | Public token balance is lower than the shield amount. | Terminal |
BALANCE_CHECK_UNAVAILABLE | Balance Check Unavailable | Cannot verify balance — sign a permit first. | Retryable |
ERC20_READ_FAILED | Token Read Failed | Could not read token balance from chain — network issue. | Retryable |
ACL_PAUSED | Protocol Paused | The FHE access-control layer is temporarily paused for maintenance. | Terminal |
APPROVAL_FAILED | Approval Failed | ERC-20 approval transaction failed — check allowance and balance. | Retryable |
Wallet errors (non-SDK): common rejection strings like
user rejected, User denied, ACTION_REJECTED, and user cancelled are caught by the fallback in classifyError()and mapped to "Request Cancelled."