Skip to main content
Version: 2.0.0-beta-1

Error codes

This section contains a list of all possible errors that might occur while using

import { Unirep } from '@unirep/contracts/Unirep.sol';

When developing with hardhat environment, these custom errors can be seen in the _selector:

Error: cannot estimate gas; transaction may fail or may require manual gas limit
{"type":18,"address":{"type":"Buffer","data":[183,248,188,99,187,202,209,129,85,32,19,8,200,243,84,11,7,248,79,94]},"message":{"value":{"type":"Buffer","data":[103,103,221,161,0,0,0,0,0,0,0,0,0,0,0,0,165,28,31,194,240,209,161,184,73,78,209,254,49,45,124,58,120,237,145,192]},"_selector":"6767dda1"},"isInvalidOpcodeError":false}],"data":"0x6767dda1000000000000000000000000a51c1fc2f0d1a1b8494ed1fe312d7c3a78ed91c0"}, code=UNPREDICTABLE_GAS_LIMIT, version=providers/5.7.2)


  • UserAlreadySignedUp(uint256 identityCommitment)
    The given identity commitment has already signed up in the current Unirep contract.
    A user cannot double sign-up in an application.


  • AttesterAlreadySignUp(uint160 attester)
    The attester has already signed up in the current Unirep contract.
    An attester cannot double sign-up in the Unirep protocol.


  • AttesterNotSignUp(uint160 attester)
    The attester has not signed up in the current Unirep contract.
    Please call attesterSignUp()


  • AttesterInvalid()
    The givein attester address is not a valid uint160 type data.
    Please check if the attester address is correctly assigned while generating proofs.


  • ProofAlreadyUsed(bytes32 nullilier)
    The proof is already used in Unirep contract.
    A proof cannot be submitted twice in the Unirep protocol. This is used to prevent replay attack.


  • NullifierAlreadyUsed(uint256 nullilier)
    The nullifier is already used in Unirep contract.
    A nullifier cannot be submitted twice in the Unirep protocol.


  • AttesterIdNotMatch(uint160 attesterId)
    The msg.sender does not match the claimed attester ID.
    Please send the transaction through the attester.


  • InvalidSignature()
    The signature does not match the attester ID.
    Please make sure the signature is signed through the correct attester.


  • InvalidEpochKey()
    The max epoch key is computed by
    uint256 maxEpochKey = uint256(config.epochTreeArity) ** config.epochTreeDepth - 1;
    The epoch key which is greater than this range is recognized invalid.
    Please check if the contract configs maxEpochKey(), epochTreeArity() and epochTreeDepth() match the circuit configs.


  • EpochNotMatch()
    Current epoch does not match the epoch in the proof or the target epoch.
    Please check the current epoch and generate a corresponding proof.


  • InvalidEpoch(uint256 epoch)
    The epoch in the proof is greater than the current epoch.
    Please check the current epoch and generate a corresponding proof.


  • InvalidProof()
    The proof is verified invalid through on-chain verifiers.
    Please verify it with the off-chain prover.
    If it is valid off-chain but invalid through on-chain verifiers, please check the if the proving keys match the ones on-chain.


  • InvalidStateTreeRoot(uint256 stateTreeRoot)
    The state tree root of given epoch does not exist in the current Unirep contract.
    There are several reasons:
    1. The user does not sign up successfully
    2. The user does not perform user state transition successfully
    3. userSignUp transaction or userStateTransition transaction is pending
    4. Epoch and state tree root does not match


  • InvalidEpochTreeRoot(uint256 epochTreeRoot)
    The epoch tree root of given epoch does not match the current Unirep contract.
    Please check if all attestations are processed correctly and successfully.


  • EpochNotSealed()
    The epoch a user is attempting to transition from has not been sealed.



  • IncorrectHash()
    The circuit should output the polysum that matches the on-chain polysum.
    If the error occurs, please check if the off-chain attestations matches the on-chain attestations.


  • MaxAttestations()
    The epoch tree can only store tree_arity ** tree_degree - 3 epoch keys per attester per epoch. See also build ordered tree.
    There is no more new epoch keys that can receive attestations. Users should wait until the next epoch and then generate a new epoch key to receive attestations.


  • NoAttestations()
    If there is no attestations in an epoch, the sealEpoch cannot be executed. Users can perform user state transition without sealEpoch and then move on to the new epoch.


  • OutOfRange()
    A replacement field data cannot be out of SNARK_SCALAR_FIELD.
    Please use a value which is less than SNARK_SCALAR_FIELD.


  • InvalidField()
    An attestation was made to a field that was either out of range, or not capable of receiving attestations.