How to Fix Precheck failed Errors
The following precheck failed
errors are typically related to gas and/or fees.
Our Bundler follows the standard ERC 4337 implementation for gas and fee checks to:
Ensure your userOp lands on chain and;
Protect the bundler from potential attacks in order to support scalability
There are many different checks bundlers run before accepting a UO.
For all possible precheck violations see here.
Below are common pre-check errors including gas and fees being too low or too high.
Gas or fee estimates too low
Here are a few example error messages:
maxPriorityFeePerGas is X but must be at least XXXX
callGasLimit is X but must be at least XXXX
preVerificationGas is X but must be at least XXX
maxFeePerGas is X but must be at least XXX
Explanation
Our bundler currently rejects upon sending userOps if they are underpriced compared to the network rate to ensure inclusion in a block. These errors are often related to market movement between the time gas and fees are estimated and the time when userOps are submitted to the bundler. This issue is especially prevalent on testnets.
Solution 1: Using API
Use our gas estimations
Reduce the time between estimation and sending
Any small delay can cause estimates to be out of date as they may fluctuate quickly
Implement retries
If your UO gets rejected, re-estimate gas and resend the User Operation
Add a multiplier on top of fee estimates to account for fluctuation
Read the parameters section of
alchemy_requestGasAndPaymasterAndData
Read more about user operation overrides
Solution 2: Using the SDK
If you are using Alchemy's infra for AA:
recommended — use an Alchemy client via any of the
create*AlchemyClient
(e.g.createLightAccountAlchemyClient
)alternative — if for some reason you must use
createSmartAccountClient
, import thealchemyFeeEstimator
middleware fromaa-alchemy
oraccount-kit/infra
(depending on which version of the SDK you're on), and override thefeeEstimator
field in your client constructor
Implement retries
Re-estimate, sign and send the user operation with updated gas and fee fields
Add a multiplier
On top of fee estimates to account for fluctuation using UserOperationOverrides
Read more about user operation overrides
Gas limit too high
Here are a few example error messages:
verificationGasLimit is X but must be at most XXX
total gas limit is X but must be at most XXX
Explanation
Gas limits are based on the max block size and max transaction size per chain. We make sure a single op is not larger than the max bundle gas and also that the combination of user operations being bundled are not larger. Total gas limit is checked against the aggregate between preVerificationGas
, verificationGasLimit
, and callGasLimit
.
Solution
To reduce the gas needed, try reducing the size of your call data and/or sending your call data in multiple UserOperation
s rather than one.