Errors & Troubleshooting¶
Common errors and how to resolve them.
Error Categories¶
| Category | Description |
|---|---|
ABIError |
Base error for all ABI-related issues |
ABINotFoundError |
ABI could not be retrieved |
ABIParseError |
ABI JSON structure is invalid |
ABIValidationError |
ABI content is invalid |
NetworkError |
Network/RPC related issues |
GenerationError |
Code generation failed |
Fetching Errors¶
Contract source code not verified¶
Cause: The contract is not verified on the block explorer.
Solutions:
-
Use a local ABI file if you have one:
-
Try Sourcify which may have the contract:
-
Verify the contract on Etherscan if you're the owner
API rate limit exceeded¶
Cause: Too many API requests to the block explorer.
Solutions:
-
Use an API key:
-
Wait and retry - rate limits usually reset quickly
-
Use a paid API plan for higher limits
Invalid address format¶
Cause: The address is not a valid Ethereum address.
Solutions:
- Check address length - must be 42 characters (0x + 40 hex)
- Check for typos in the address
- Include 0x prefix
Network not found¶
Cause: The specified network is not configured.
Solutions:
-
Check network name - use
--network mainnet, not--network ethereum -
See available networks:
-
Add custom network - see Custom Networks Guide
Parsing Errors¶
Invalid ABI structure¶
Cause: The ABI is not a valid JSON array.
Solutions:
-
Check file format - ABI should be a JSON array:
-
Extract from artifact - Hardhat/Truffle artifacts wrap ABI:
Unknown type¶
Cause: A custom or non-standard type was found.
Solutions:
-
Check ABI source - may be corrupted or modified
-
User-defined types are typically tuples in the ABI:
Missing required field¶
Cause: An ABI entry is missing required fields.
Solutions:
-
Validate ABI format using:
-
Check ABI source - may be truncated or corrupted
Generation Errors¶
Output directory exists¶
Cause: The output directory is not empty.
Solutions:
-
Use --force to overwrite:
-
Choose different directory:
Template error¶
Cause: Custom template has an error.
Solutions:
- Check custom templates for syntax errors
- Use default templates by removing custom template config
- Check variable names match available context
Runtime Errors¶
Could not connect to RPC¶
Cause: The RPC endpoint is unreachable.
Solutions:
- Check RPC URL is correct
- Check network connectivity
- Try a different RPC provider
- Check API key if using authenticated endpoint
execution reverted¶
Cause: The contract function reverted.
Common Causes:
| Message | Meaning |
|---|---|
transfer amount exceeds balance |
Not enough tokens |
insufficient allowance |
Need to approve first |
Ownable: caller is not the owner |
Only owner can call |
Pausable: paused |
Contract is paused |
Solutions:
- Check balances before transferring
- Check allowances before transferFrom
- Verify permissions for restricted functions
- Check contract state (paused, etc.)
Insufficient funds for gas¶
Cause: Not enough ETH for transaction gas.
Solutions:
- Add ETH to your wallet
- Reduce gas price (may take longer)
- Use simulation to estimate cost first
Nonce too low¶
Cause: Transaction with this nonce already mined.
Solutions:
- Wait for pending transactions to confirm
- Get current nonce from chain:
Chain ID mismatch¶
Cause: Connected to wrong network.
Solutions:
- Check RPC URL matches intended network
- Check chain ID in configuration
- Use correct network flag:
Troubleshooting Checklist¶
Generation Issues¶
- [ ] Is the ABI source valid? (
abi-to-mcp validate) - [ ] Is the address correct format?
- [ ] Is the network specified correctly?
- [ ] Do you have an API key set?
- [ ] Is the output directory writable?
Runtime Issues¶
- [ ] Is RPC_URL set correctly?
- [ ] Is the RPC endpoint accessible?
- [ ] Is PRIVATE_KEY set (for writes)?
- [ ] Do you have sufficient balance?
- [ ] Are you on the correct network?
Contract Issues¶
- [ ] Is the contract verified?
- [ ] Is the contract address correct?
- [ ] Is the contract on this network?
- [ ] Is the ABI up to date?
Getting Help¶
If you can't resolve an issue:
-
Check existing issues: GitHub Issues
-
Open a new issue with:
- Full error message
- Command or code used
- ABI file (if not from verified contract)
-
Network and address
-
Enable debug logging: