Custom Error Decoder
Free to download on every platform. Comes pre-installed on BotFone, BotPad and BotFlip — with extra free apps included.
About this app
WHAT IT DOES
Custom Error Decoder is a read-only tool that detects and decodes custom Solidity errors from transaction reverts, generating AI-powered explanations of what the error means and how to fix it. It reads revert error bytes (custom error selector plus encoded data), custom error signatures from the contract ABI, contract bytecode, ABI fragments, function selector, transaction calldata, target contract address, sender address, block number, timestamp, call trace, gas used, contract state at call time, and failure history for similar custom errors. The tool then presents this data alongside an AI-generated explanation of the error name, what the parameters represent, what condition triggered the error, and recommended fixes — helping you understand and resolve custom errors before retrying.
HOW TO USE
Connect your wallet using the BGWallet bridge and select your target network. Enter the transaction hash or revert bytes you want to decode, along with the target contract address. Optionally enter error ABI signatures (comma-separated) to help with decoding. Click "Decode custom error" to read on-chain revert data. The tool displays the error data, contract address, error name, and error selector. Detailed information includes parameters, meaning, function selector, call trace, gas used, block number, sender address, and similar error patterns. A recommended fix box provides specific steps to resolve the issue. An AI explanation appears below the on-chain data, detecting and decoding the custom Solidity error, explaining what the error name means, what the error parameters represent, what condition triggered the error, and recommending specific actions to fix the issue before you retry the transaction. The wallet's own signature step still protects you — this explanation is informational only and does not replace reviewing what you approve in your wallet.
TECHNICAL MECHANISM
The tool uses ethers.js v5.7.2 with the provider from the BGWallet bridge to read on-chain revert data and decode custom errors. No hardcoded contract addresses are used — you are always in control of which contract you trust. When decoding custom errors, the tool reads the revert error bytes from the transaction receipt or simulation, extracts the custom error selector (first 4 bytes of the revert data), reads custom error signatures from the contract ABI (from the user input or from the contract's metadata), reads contract bytecode via provider.getCode(contract), reads ABI fragments from the contract metadata, extracts the function selector from the calldata, reads transaction calldata from the transaction object, reads the target contract address from the user input, reads sender address from the transaction, reads block number and timestamp from the provider, analyzes the call trace from the simulation, reads gas used from the receipt or simulation, reads contract state at call time via view functions, and checks failure history for similar custom errors by scanning past failed transactions. The tool fetches event logs by walking backwards in chunks and halving chunk size on failure, ensuring logs are properly read despite varying RPC limitations. The data is formatted and passed to the AI bridge via BGAI.generate() with a structured prompt that includes all the on-chain data read. The AI is instructed to detect and decode the custom Solidity error, explain what the error name and parameters mean, what condition triggered the error, and recommend specific fixes — while stating plainly that it cannot decode custom errors that are not defined in the contract's ABI or source code, cannot guarantee that the decoded error accurately reflects the intent behind the revert, and cannot predict whether a retry will succeed. The AI response is capped at 1,024 tokens to ensure concise, focused error explanations. All computed values are guarded against negative numbers — if a gas used or block number appears invalid, the tool flags it rather than displaying nonsensical values.
WHAT IT CANNOT SEE
This tool cannot decode custom errors that are not defined in the contract's ABI or source code. It cannot guarantee that the decoded error name and parameters accurately reflect the intent behind the revert. It cannot detect off-chain factors or social engineering that may have caused the revert. It cannot predict whether a retry will succeed. The AI explanation is generated from on-chain revert data and ABI information only and cannot detect off-chain conditions, hidden contract state, or social engineering factors. It cannot predict whether a retry will succeed after making the recommended fixes. The tool does not continuously monitor error patterns; each analysis is a snapshot at the time of the lookup. It cannot detect delayed failures, off-chain changes, or hidden conditions. The tool does not store any data persistently; all state is in-memory and resets on reload. The AI explanation is informational and does not constitute financial advice, legal advice, or a guarantee of transaction success or fix correctness.
PLEASE NOTE
Custom Error Decoder works exclusively with EVM-compatible chains. It requires a Web3 wallet (MetaMask or similar) and the BGWallet bridge. Explanations are AI-generated from data the app reads on-chain — always review what you are actually signing in your wallet before approving it. Custom errors provide more detailed revert information than string messages, but they require the contract's ABI to decode properly. Use this tool as a guide only; always cross-check with contract documentation and independent sources for critical decisions. This is experimental software; use at your own risk.