This guide catalogs common errors encountered when developing and deploying LayerZero contracts on Starknet, with explanations and solutions.
Account Errors
Account Not Deployed
Error:
Cause: You’re trying to use an account that hasn’t been deployed yet. On Starknet, accounts are smart contracts that must be deployed before use.
Solution:
Insufficient Balance for Fee
Error:
Cause: Your account contract doesn’t have enough STRK or ETH to pay transaction fees.
Solution:
- Fund your account with STRK or ETH
- For testnet, use the Starknet Faucet
- For mainnet, bridge funds via Starkgate
Account Prefunding Required
Error:
Cause: Before deploying an account contract, the computed address must be funded. Starknet computes the address deterministically, so you can fund it before deployment.
Solution:
Declare Errors
Class Already Declared
Error:
Cause: You’re trying to declare a contract class that already exists on the network.
Solution:
Compilation Failed
Error:
Cause: Cairo compilation errors in your contract.
Solution:
Deploy Errors
Error: After deployment, the owner is set to an unexpected address (the UDC address).
Cause: When deploying via the Universal Deployer Contract (UDC), get_caller_address() in the constructor returns the UDC address, not your account.
Wrong pattern:
Solution:
Invalid Constructor Calldata
Error:
or
Cause: Constructor calldata doesn’t match the expected parameters.
Solution:
- Verify parameter order matches constructor signature
- Check ByteArray encoding (length, data, pending_word, pending_len)
- Verify felt252 encoding for addresses and numbers
Resource Bounds Exceeded
Error:
or
Cause: The transaction requires more resources than your specified limits.
Solution:
1 STRK = 10^18 fri
Configuration Errors
Peer Not Set
Error:
Cause: Attempting to send a message to a chain without a configured peer.
Solution:
Remember: Peers must be set bidirectionally on both chains.
Invalid Peer
Error:
Cause: Received a message from an address that doesn’t match the configured peer.
Causes:
- Peer set incorrectly on either chain
- Using Object ID instead of contract address
- Peer not set at all on sending chain
Solution:
Library Not Set
Error:
Cause: No send or receive library configured for the pathway.
Solution: Use default libraries or set custom ones:
Serialization Errors
Felt Overflow
Error:
Cause: Attempting to store a value larger than ~2^251 in a felt252.
Solution:
ByteArray Encoding Error
Error:
Cause: Incorrect ByteArray encoding in calldata.
ByteArray structure:
Solution:
For short strings (< 31 bytes), use simplified encoding with --arguments:
When using --arguments, sncast handles ByteArray encoding automatically. You can pass strings directly in quotes.
Execution Errors
Unauthorized
Error:
or
Cause: Calling an owner-only function from a non-owner account.
Solution:
Contract Not Pausable
Error:
Cause: Calling a function on a paused contract.
Solution:
Rate Limit Exceeded
Error:
Cause: Transfer volume exceeds configured rate limits (OFTMintBurnAdapter).
Solution:
Crosschain Errors
Insufficient Fee
Error:
Cause: Not enough tokens approved or sent for LayerZero messaging fees.
Solution:
Slippage Exceeded
Error:
Cause: After dust removal and fees, the received amount is less than min_amount_ld.
Solution:
Message Execution Failed
Error (on LayerZero Scan):
Cause: The destination contract’s _lz_receive reverted.
Debug Steps:
- Check LayerZero Scan for the transaction details
- Look for the
LzReceiveAlert event
- Decode the
reason array for error details
- Simulate the transaction locally
Common causes:
- Insufficient gas (increase enforced options)
- Contract paused on destination
- Rate limit exceeded
- Application logic error
Build Errors
Missing Dependencies
Error:
Cause: Dependencies not properly configured in Scarb.toml.
Solution:
Install the LayerZero Starknet package first: npm install @layerzerolabs/protocol-starknet-v2
Version Mismatch
Error:
Cause: Scarb/Cairo version doesn’t match project requirements.
Solution:
Debugging Tips
1. Use LayerZero Scan
Track your crosschain transactions at LayerZero Scan.
2. Check Transaction Status
3. Simulate Locally
Test your logic with snforge test before deploying.
4. Increase Verbosity
5. Check Events
Query contract events via block explorer or RPC:
Next Steps