Reverts & error codes
Symptom
Error: execution reverted (unknown custom error)or with a selector like 0x82b42900.
Cause
The Diamond's facets emit custom errors (Solidity 0.8.4+). The 4-byte selector identifies which error; without the ABI you can't decode it.
Fix
Use sdk.parseError
try {
await sdk.commitToOffer(buyer, offerId)
} catch (err) {
const parsed = sdk.parseError(err)
console.error(parsed) // { code: "OfferVoided", name: "OfferVoided", args: { offerId: "123" } }
}Or decode against the merged ABI
import offerAbi from "@bosonprotocol/common/dist/cjs/abis/IBosonOfferHandler.json"
import exchangeAbi from "@bosonprotocol/common/dist/cjs/abis/IBosonExchangeHandler.json"
import disputeAbi from "@bosonprotocol/common/dist/cjs/abis/IBosonDisputeHandler.json"
import fundsAbi from "@bosonprotocol/common/dist/cjs/abis/IBosonFundsHandler.json"
import priceAbi from "@bosonprotocol/common/dist/cjs/abis/IBosonPriceDiscoveryHandler.json"
import { ethers } from "ethers"
const iface = new ethers.utils.Interface([...offerAbi, ...exchangeAbi, ...disputeAbi, ...fundsAbi, ...priceAbi])
try {
iface.parseError(err.data ?? err.error?.data)
} catch { /* not a known custom error */ }Common errors and their meaning
| Error | Cause | Fix |
|---|---|---|
RegionPaused | Protocol region paused | Wait; check pausedRegions() |
OfferHasExpired | validUntilDate < now | Use a different offer |
OfferVoided | Seller voided the offer | Use a different offer |
QuantityExceeded | Sold out | Wait or try a variant |
CannotCommit | Token-gating condition not met | Acquire the gating token |
ExchangeIsNotInRedeemableState | Wrong state or window closed | Check exchange state |
VoucherNotExpired | Tried to expire voucher early | Wait |
DisputeNotEscalatable | Dispute not yet eligible to escalate | Wait for resolution window |
InvalidNonce | Meta-tx nonce already used | Re-fetch nonce, re-sign |
SignatureValidationFailed | EIP-712 didn't recover to expected signer | See Signature mismatches |
InsufficientValueReceived | msg.value < price for native offer | Send more |
InsufficientAllowance | ERC-20 not approved | Approve first |
For the full catalog, see Reference → Contracts → Custom errors.
Logging
Always log the parsed error code, not just the message. The code is grep-able; the message is wrapped by RPC providers and varies.