Error Codes

Common revert reasons and how to resolve them.

PoolController

ErrorCauseResolution
InvalidAmountDeposit amount is 0Ensure amount > 0
CommitmentAlreadyUsedCommitment was already depositedGenerate new secret/nullifier pair
NullifierAlreadyUsedNullifier was already spentThis deposit was already withdrawn
InvalidProofZK proof verification failedCheck inputs match original deposit
InsufficientBalancePool has less than withdrawal amountWait for rebalance or reduce amount
TransferFailedWETH transfer revertedCheck WETH approval and balance

AIRecommendationCommitment

ErrorCauseResolution
OnlyAIServiceCaller is not authorized AI serviceUse correct AI service address
RecommendationNotFoundInvalid recommendation IDCheck ID from commitment event
RecommendationExpiredRecommendation too old to executeGenerate new recommendation
AlreadyExecutedRecommendation was already usedEach recommendation single-use
CommitmentMismatchProvided allocations don't match hashUse exact values from commitment

DAOConstraintManager

ErrorCauseResolution
ExceedsMaxAllocationSingle protocol > max limitReduce allocation to comply with policy
InsufficientDiversificationToo few protocols with allocationSpread across more protocols
VolatilityTooHighRisk score exceeds thresholdWait for market conditions to improve
ManualApprovalRequiredPolicy requires governance voteSubmit to DAO for approval
OnlyGovernanceCaller is not governance contractPolicy changes require governance

Frontend / Client Errors

ErrorCauseResolution
ChunkLoadErrorFailed to load circomlibjs WASMRefresh page, check network
DecryptionFailedWrong wallet for encrypted noteConnect original deposit wallet
ProofGenerationFailedInvalid inputs to circuitVerify secret/nullifier match deposit
NetworkMismatchWallet on wrong chainSwitch to Anvil (31337)
UserRejectedUser rejected transactionApprove transaction in wallet

Debugging Tips

Check Contract State

# Check if commitment exists
cast call $POOL_CONTROLLER "commitments(bytes32)" $COMMITMENT

# Check if nullifier is spent
cast call $POOL_CONTROLLER "nullifierUsed(bytes32)" $NULLIFIER

# Get current allocation weights
cast call $STRATEGY_ROUTER "getAllocationBreakdown()"

# Get DAO policy
cast call $DAO_MANAGER "getActivePolicy()"

Trace Failed Transaction

# Get revert reason from Anvil
cast run $TX_HASH --rpc-url http://localhost:8545

# Or use Foundry's trace
forge script --debug script/SomeScript.s.sol

Verify Proof Locally

# Using snarkjs CLI
snarkjs groth16 verify \
  public/circuits/keys/verification_key.json \
  public_signals.json \
  proof.json