Are you an LLM? Read llms.txt for a summary of the docs, or llms-full.txt for the full context.
Troubleshooting — Reverts & error codes · Boson Protocol
Skip to content

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

ErrorCauseFix
RegionPausedProtocol region pausedWait; check pausedRegions()
OfferHasExpiredvalidUntilDate < nowUse a different offer
OfferVoidedSeller voided the offerUse a different offer
QuantityExceededSold outWait or try a variant
CannotCommitToken-gating condition not metAcquire the gating token
ExchangeIsNotInRedeemableStateWrong state or window closedCheck exchange state
VoucherNotExpiredTried to expire voucher earlyWait
DisputeNotEscalatableDispute not yet eligible to escalateWait for resolution window
InvalidNonceMeta-tx nonce already usedRe-fetch nonce, re-sign
SignatureValidationFailedEIP-712 didn't recover to expected signerSee Signature mismatches
InsufficientValueReceivedmsg.value < price for native offerSend more
InsufficientAllowanceERC-20 not approvedApprove 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.

Related